MCPcopy Create free account
hub / github.com/bclinkinbeard/angular / applyDirectivesToNode

Function applyDirectivesToNode

test/fixtures/foo.js:6295–6728  ·  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

6293 * @returns {Function} linkFn
6294 */
6295 function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
6296 jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
6297 previousCompileContext) {
6298 previousCompileContext = previousCompileContext || {};
6299
6300 var terminalPriority = -Number.MAX_VALUE,
6301 newScopeDirective,
6302 controllerDirectives = previousCompileContext.controllerDirectives,
6303 newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
6304 templateDirective = previousCompileContext.templateDirective,
6305 nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
6306 hasTranscludeDirective = false,
6307 hasTemplate = false,
6308 hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
6309 $compileNode = templateAttrs.$$element = jqLite(compileNode),
6310 directive,
6311 directiveName,
6312 $template,
6313 replaceDirective = originalReplaceDirective,
6314 childTranscludeFn = transcludeFn,
6315 linkFn,
6316 directiveValue;
6317
6318 // executes all directives on the current element
6319 for(var i = 0, ii = directives.length; i < ii; i++) {
6320 directive = directives[i];
6321 var attrStart = directive.$$start;
6322 var attrEnd = directive.$$end;
6323
6324 // collect multiblock sections
6325 if (attrStart) {
6326 $compileNode = groupScan(compileNode, attrStart, attrEnd);
6327 }
6328 $template = undefined;
6329
6330 if (terminalPriority > directive.priority) {
6331 break; // prevent further processing of directives
6332 }
6333
6334 if (directiveValue = directive.scope) {
6335 newScopeDirective = newScopeDirective || directive;
6336
6337 // skip the check for directives with async templates, we'll check the derived sync
6338 // directive when the template arrives
6339 if (!directive.templateUrl) {
6340 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,
6341 $compileNode);
6342 if (isObject(directiveValue)) {
6343 newIsolateScopeDirective = directive;
6344 }
6345 }
6346 }
6347
6348 directiveName = directive.name;
6349
6350 if (!directive.templateUrl && directive.controller) {
6351 directiveValue = directive.controller;
6352 controllerDirectives = controllerDirectives || {};

Callers 2

compileNodesFunction · 0.85
compileTemplateUrlFunction · 0.85

Calls 15

groupScanFunction · 0.85
assertNoDuplicateFunction · 0.85
isObjectFunction · 0.85
replaceWithFunction · 0.85
sliceArgsFunction · 0.85
compileFunction · 0.85
jqLiteCloneFunction · 0.85
isFunctionFunction · 0.85
jqLiteIsTextNodeFunction · 0.85
collectDirectivesFunction · 0.85
markDirectivesAsIsolateFunction · 0.85
mergeTemplateAttributesFunction · 0.85

Tested by

no test coverage detected