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

Function applyDirectivesToNode

test/angular/1.4/angular.js:8191–8616  ·  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

8189 * @returns {Function} linkFn
8190 */
8191 function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
8192 jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
8193 previousCompileContext) {
8194 previousCompileContext = previousCompileContext || {};
8195
8196 var terminalPriority = -Number.MAX_VALUE,
8197 newScopeDirective = previousCompileContext.newScopeDirective,
8198 controllerDirectives = previousCompileContext.controllerDirectives,
8199 newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
8200 templateDirective = previousCompileContext.templateDirective,
8201 nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
8202 hasTranscludeDirective = false,
8203 hasTemplate = false,
8204 hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
8205 $compileNode = templateAttrs.$$element = jqLite(compileNode),
8206 directive,
8207 directiveName,
8208 $template,
8209 replaceDirective = originalReplaceDirective,
8210 childTranscludeFn = transcludeFn,
8211 linkFn,
8212 directiveValue;
8213
8214 // executes all directives on the current element
8215 for (var i = 0, ii = directives.length; i < ii; i++) {
8216 directive = directives[i];
8217 var attrStart = directive.$$start;
8218 var attrEnd = directive.$$end;
8219
8220 // collect multiblock sections
8221 if (attrStart) {
8222 $compileNode = groupScan(compileNode, attrStart, attrEnd);
8223 }
8224 $template = undefined;
8225
8226 if (terminalPriority > directive.priority) {
8227 break; // prevent further processing of directives
8228 }
8229
8230 if (directiveValue = directive.scope) {
8231
8232 // skip the check for directives with async templates, we'll check the derived sync
8233 // directive when the template arrives
8234 if (!directive.templateUrl) {
8235 if (isObject(directiveValue)) {
8236 // This directive is trying to add an isolated scope.
8237 // Check that there is no scope of any kind already
8238 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,
8239 directive, $compileNode);
8240 newIsolateScopeDirective = directive;
8241 } else {
8242 // This directive is trying to add a child scope.
8243 // Check that there is no isolated scope already
8244 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,
8245 $compileNode);
8246 }
8247 }
8248

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
compileFunction · 0.70
jqLiteCloneFunction · 0.70
isFunctionFunction · 0.70
jqLiteIsTextNodeFunction · 0.70
removeCommentsFunction · 0.70
wrapTemplateFunction · 0.70

Tested by

no test coverage detected