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

Function applyDirectivesToNode

test/angular/1.6/angular.js:9594–10125  ·  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

9592 * @returns {Function} linkFn
9593 */
9594 function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
9595 jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
9596 previousCompileContext) {
9597 previousCompileContext = previousCompileContext || {};
9598
9599 var terminalPriority = -Number.MAX_VALUE,
9600 newScopeDirective = previousCompileContext.newScopeDirective,
9601 controllerDirectives = previousCompileContext.controllerDirectives,
9602 newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
9603 templateDirective = previousCompileContext.templateDirective,
9604 nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
9605 hasTranscludeDirective = false,
9606 hasTemplate = false,
9607 hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
9608 $compileNode = templateAttrs.$$element = jqLite(compileNode),
9609 directive,
9610 directiveName,
9611 $template,
9612 replaceDirective = originalReplaceDirective,
9613 childTranscludeFn = transcludeFn,
9614 linkFn,
9615 didScanForMultipleTransclusion = false,
9616 mightHaveMultipleTransclusionError = false,
9617 directiveValue;
9618
9619 // executes all directives on the current element
9620 for (var i = 0, ii = directives.length; i < ii; i++) {
9621 directive = directives[i];
9622 var attrStart = directive.$$start;
9623 var attrEnd = directive.$$end;
9624
9625 // collect multiblock sections
9626 if (attrStart) {
9627 $compileNode = groupScan(compileNode, attrStart, attrEnd);
9628 }
9629 $template = undefined;
9630
9631 if (terminalPriority > directive.priority) {
9632 break; // prevent further processing of directives
9633 }
9634
9635 directiveValue = directive.scope;
9636
9637 if (directiveValue) {
9638
9639 // skip the check for directives with async templates, we'll check the derived sync
9640 // directive when the template arrives
9641 if (!directive.templateUrl) {
9642 if (isObject(directiveValue)) {
9643 // This directive is trying to add an isolated scope.
9644 // Check that there is no scope of any kind already
9645 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,
9646 directive, $compileNode);
9647 newIsolateScopeDirective = directive;
9648 } else {
9649 // This directive is trying to add a child scope.
9650 // Check that there is no isolated scope already
9651 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,

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