MCPcopy Create free account
hub / github.com/aosabook/500lines / applyDirectivesToNode

Function applyDirectivesToNode

spreadsheet/code/lib/angular.js:7182–7653  ·  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

7180 * @returns {Function} linkFn
7181 */
7182 function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
7183 jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
7184 previousCompileContext) {
7185 previousCompileContext = previousCompileContext || {};
7186
7187 var terminalPriority = -Number.MAX_VALUE,
7188 newScopeDirective,
7189 controllerDirectives = previousCompileContext.controllerDirectives,
7190 controllers,
7191 newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
7192 templateDirective = previousCompileContext.templateDirective,
7193 nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
7194 hasTranscludeDirective = false,
7195 hasTemplate = false,
7196 hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
7197 $compileNode = templateAttrs.$$element = jqLite(compileNode),
7198 directive,
7199 directiveName,
7200 $template,
7201 replaceDirective = originalReplaceDirective,
7202 childTranscludeFn = transcludeFn,
7203 linkFn,
7204 directiveValue;
7205
7206 // executes all directives on the current element
7207 for(var i = 0, ii = directives.length; i < ii; i++) {
7208 directive = directives[i];
7209 var attrStart = directive.$$start;
7210 var attrEnd = directive.$$end;
7211
7212 // collect multiblock sections
7213 if (attrStart) {
7214 $compileNode = groupScan(compileNode, attrStart, attrEnd);
7215 }
7216 $template = undefined;
7217
7218 if (terminalPriority > directive.priority) {
7219 break; // prevent further processing of directives
7220 }
7221
7222 if (directiveValue = directive.scope) {
7223
7224 // skip the check for directives with async templates, we'll check the derived sync
7225 // directive when the template arrives
7226 if (!directive.templateUrl) {
7227 if (isObject(directiveValue)) {
7228 // This directive is trying to add an isolated scope.
7229 // Check that there is no scope of any kind already
7230 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,
7231 directive, $compileNode);
7232 newIsolateScopeDirective = directive;
7233 } else {
7234 // This directive is trying to add a child scope.
7235 // Check that there is no isolated scope already
7236 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,
7237 $compileNode);
7238 }
7239 }

Callers 2

compileNodesFunction · 0.85
compileTemplateUrlFunction · 0.85

Calls 15

groupScanFunction · 0.85
isObjectFunction · 0.85
assertNoDuplicateFunction · 0.85
replaceWithFunction · 0.85
sliceArgsFunction · 0.85
compileFunction · 0.85
jqLiteCloneFunction · 0.85
isFunctionFunction · 0.85
jqLiteIsTextNodeFunction · 0.85
removeCommentsFunction · 0.85
wrapTemplateFunction · 0.85
trimFunction · 0.85

Tested by

no test coverage detected