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

Function applyDirectivesToNode

test/angular/1.7/angular.js:10141–10642  ·  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

10139 * @returns {Function} linkFn
10140 */
10141 function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
10142 jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
10143 previousCompileContext) {
10144 previousCompileContext = previousCompileContext || {};
10145
10146 var terminalPriority = -Number.MAX_VALUE,
10147 newScopeDirective = previousCompileContext.newScopeDirective,
10148 controllerDirectives = previousCompileContext.controllerDirectives,
10149 newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
10150 templateDirective = previousCompileContext.templateDirective,
10151 nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
10152 hasTranscludeDirective = false,
10153 hasTemplate = false,
10154 hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
10155 $compileNode = templateAttrs.$$element = jqLite(compileNode),
10156 directive,
10157 directiveName,
10158 $template,
10159 replaceDirective = originalReplaceDirective,
10160 childTranscludeFn = transcludeFn,
10161 linkFn,
10162 didScanForMultipleTransclusion = false,
10163 mightHaveMultipleTransclusionError = false,
10164 directiveValue;
10165
10166 // executes all directives on the current element
10167 for (var i = 0, ii = directives.length; i < ii; i++) {
10168 directive = directives[i];
10169 var attrStart = directive.$$start;
10170 var attrEnd = directive.$$end;
10171
10172 // collect multiblock sections
10173 if (attrStart) {
10174 $compileNode = groupScan(compileNode, attrStart, attrEnd);
10175 }
10176 $template = undefined;
10177
10178 if (terminalPriority > directive.priority) {
10179 break; // prevent further processing of directives
10180 }
10181
10182 directiveValue = directive.scope;
10183
10184 if (directiveValue) {
10185
10186 // skip the check for directives with async templates, we'll check the derived sync
10187 // directive when the template arrives
10188 if (!directive.templateUrl) {
10189 if (isObject(directiveValue)) {
10190 // This directive is trying to add an isolated scope.
10191 // Check that there is no scope of any kind already
10192 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,
10193 directive, $compileNode);
10194 newIsolateScopeDirective = directive;
10195 } else {
10196 // This directive is trying to add a child scope.
10197 // Check that there is no isolated scope already
10198 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