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

Function applyDirectivesToNode

lib/test/angular/1.7.0/angular.js:9633–10131  ·  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

9631 * @returns {Function} linkFn
9632 */
9633 function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
9634 jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
9635 previousCompileContext) {
9636 previousCompileContext = previousCompileContext || {};
9637
9638 var terminalPriority = -Number.MAX_VALUE,
9639 newScopeDirective = previousCompileContext.newScopeDirective,
9640 controllerDirectives = previousCompileContext.controllerDirectives,
9641 newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
9642 templateDirective = previousCompileContext.templateDirective,
9643 nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
9644 hasTranscludeDirective = false,
9645 hasTemplate = false,
9646 hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
9647 $compileNode = templateAttrs.$$element = jqLite(compileNode),
9648 directive,
9649 directiveName,
9650 $template,
9651 replaceDirective = originalReplaceDirective,
9652 childTranscludeFn = transcludeFn,
9653 linkFn,
9654 didScanForMultipleTransclusion = false,
9655 mightHaveMultipleTransclusionError = false,
9656 directiveValue;
9657
9658 // executes all directives on the current element
9659 for (var i = 0, ii = directives.length; i < ii; i++) {
9660 directive = directives[i];
9661 var attrStart = directive.$$start;
9662 var attrEnd = directive.$$end;
9663
9664 // collect multiblock sections
9665 if (attrStart) {
9666 $compileNode = groupScan(compileNode, attrStart, attrEnd);
9667 }
9668 $template = undefined;
9669
9670 if (terminalPriority > directive.priority) {
9671 break; // prevent further processing of directives
9672 }
9673
9674 directiveValue = directive.scope;
9675
9676 if (directiveValue) {
9677
9678 // skip the check for directives with async templates, we'll check the derived sync
9679 // directive when the template arrives
9680 if (!directive.templateUrl) {
9681 if (isObject(directiveValue)) {
9682 // This directive is trying to add an isolated scope.
9683 // Check that there is no scope of any kind already
9684 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,
9685 directive, $compileNode);
9686 newIsolateScopeDirective = directive;
9687 } else {
9688 // This directive is trying to add a child scope.
9689 // Check that there is no isolated scope already
9690 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