MCPcopy
hub / github.com/angular-ui/ui-grid / applyDirectivesToNode

Function applyDirectivesToNode

lib/test/angular/1.5.0/angular.js:8474–9024  ·  view source on GitHub ↗

* Once the directives have been collected, their compile functions are executed. This method * is responsible for inlining directive templates as well as terminating the application * of the directives if the terminal directive has been reached. * * @param {Array} directives Arra

(directives, compileNode, templateAttrs, transcludeFn,
                                   jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
                                   previousCompileContext)

Source from the content-addressed store, hash-verified

8472 * @returns {Function} linkFn
8473 */
8474 function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
8475 jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
8476 previousCompileContext) {
8477 previousCompileContext = previousCompileContext || {};
8478
8479 var terminalPriority = -Number.MAX_VALUE,
8480 newScopeDirective = previousCompileContext.newScopeDirective,
8481 controllerDirectives = previousCompileContext.controllerDirectives,
8482 newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
8483 templateDirective = previousCompileContext.templateDirective,
8484 nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
8485 hasTranscludeDirective = false,
8486 hasTemplate = false,
8487 hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
8488 $compileNode = templateAttrs.$$element = jqLite(compileNode),
8489 directive,
8490 directiveName,
8491 $template,
8492 replaceDirective = originalReplaceDirective,
8493 childTranscludeFn = transcludeFn,
8494 linkFn,
8495 didScanForMultipleTransclusion = false,
8496 mightHaveMultipleTransclusionError = false,
8497 directiveValue;
8498
8499 // executes all directives on the current element
8500 for (var i = 0, ii = directives.length; i < ii; i++) {
8501 directive = directives[i];
8502 var attrStart = directive.$$start;
8503 var attrEnd = directive.$$end;
8504
8505 // collect multiblock sections
8506 if (attrStart) {
8507 $compileNode = groupScan(compileNode, attrStart, attrEnd);
8508 }
8509 $template = undefined;
8510
8511 if (terminalPriority > directive.priority) {
8512 break; // prevent further processing of directives
8513 }
8514
8515 if (directiveValue = directive.scope) {
8516
8517 // skip the check for directives with async templates, we'll check the derived sync
8518 // directive when the template arrives
8519 if (!directive.templateUrl) {
8520 if (isObject(directiveValue)) {
8521 // This directive is trying to add an isolated scope.
8522 // Check that there is no scope of any kind already
8523 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,
8524 directive, $compileNode);
8525 newIsolateScopeDirective = directive;
8526 } else {
8527 // This directive is trying to add a child scope.
8528 // Check that there is no isolated scope already
8529 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,
8530 $compileNode);
8531 }

Callers 2

compileNodesFunction · 0.70
compileTemplateUrlFunction · 0.70

Calls 15

groupScanFunction · 0.70
isObjectFunction · 0.70
assertNoDuplicateFunction · 0.70
createMapFunction · 0.70
replaceWithFunction · 0.70
sliceArgsFunction · 0.70
compilationGeneratorFunction · 0.70
jqLiteCloneFunction · 0.70
forEachFunction · 0.70
directiveNormalizeFunction · 0.70
nodeName_Function · 0.70
isFunctionFunction · 0.70

Tested by

no test coverage detected