* 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)
| 6368 | * @returns {Function} linkFn |
| 6369 | */ |
| 6370 | function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, |
| 6371 | jqCollection, originalReplaceDirective, preLinkFns, postLinkFns, |
| 6372 | previousCompileContext) { |
| 6373 | previousCompileContext = previousCompileContext || {}; |
| 6374 | |
| 6375 | var terminalPriority = -Number.MAX_VALUE, |
| 6376 | newScopeDirective, |
| 6377 | controllerDirectives = previousCompileContext.controllerDirectives, |
| 6378 | newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective, |
| 6379 | templateDirective = previousCompileContext.templateDirective, |
| 6380 | nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective, |
| 6381 | hasTranscludeDirective = false, |
| 6382 | hasTemplate = false, |
| 6383 | hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective, |
| 6384 | $compileNode = templateAttrs.$$element = jqLite(compileNode), |
| 6385 | directive, |
| 6386 | directiveName, |
| 6387 | $template, |
| 6388 | replaceDirective = originalReplaceDirective, |
| 6389 | childTranscludeFn = transcludeFn, |
| 6390 | linkFn, |
| 6391 | directiveValue; |
| 6392 | |
| 6393 | // executes all directives on the current element |
| 6394 | for(var i = 0, ii = directives.length; i < ii; i++) { |
| 6395 | directive = directives[i]; |
| 6396 | var attrStart = directive.$$start; |
| 6397 | var attrEnd = directive.$$end; |
| 6398 | |
| 6399 | // collect multiblock sections |
| 6400 | if (attrStart) { |
| 6401 | $compileNode = groupScan(compileNode, attrStart, attrEnd); |
| 6402 | } |
| 6403 | $template = undefined; |
| 6404 | |
| 6405 | if (terminalPriority > directive.priority) { |
| 6406 | break; // prevent further processing of directives |
| 6407 | } |
| 6408 | |
| 6409 | if (directiveValue = directive.scope) { |
| 6410 | newScopeDirective = newScopeDirective || directive; |
| 6411 | |
| 6412 | // skip the check for directives with async templates, we'll check the derived sync |
| 6413 | // directive when the template arrives |
| 6414 | if (!directive.templateUrl) { |
| 6415 | assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive, |
| 6416 | $compileNode); |
| 6417 | if (isObject(directiveValue)) { |
| 6418 | newIsolateScopeDirective = directive; |
| 6419 | } |
| 6420 | } |
| 6421 | } |
| 6422 | |
| 6423 | directiveName = directive.name; |
| 6424 | |
| 6425 | if (!directive.templateUrl && directive.controller) { |
| 6426 | directiveValue = directive.controller; |
| 6427 | controllerDirectives = controllerDirectives || {}; |
no test coverage detected