* 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)
| 9521 | * @returns {Function} linkFn |
| 9522 | */ |
| 9523 | function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, |
| 9524 | jqCollection, originalReplaceDirective, preLinkFns, postLinkFns, |
| 9525 | previousCompileContext) { |
| 9526 | previousCompileContext = previousCompileContext || {}; |
| 9527 | |
| 9528 | var terminalPriority = -Number.MAX_VALUE, |
| 9529 | newScopeDirective = previousCompileContext.newScopeDirective, |
| 9530 | controllerDirectives = previousCompileContext.controllerDirectives, |
| 9531 | newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective, |
| 9532 | templateDirective = previousCompileContext.templateDirective, |
| 9533 | nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective, |
| 9534 | hasTranscludeDirective = false, |
| 9535 | hasTemplate = false, |
| 9536 | hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective, |
| 9537 | $compileNode = templateAttrs.$$element = jqLite(compileNode), |
| 9538 | directive, |
| 9539 | directiveName, |
| 9540 | $template, |
| 9541 | replaceDirective = originalReplaceDirective, |
| 9542 | childTranscludeFn = transcludeFn, |
| 9543 | linkFn, |
| 9544 | didScanForMultipleTransclusion = false, |
| 9545 | mightHaveMultipleTransclusionError = false, |
| 9546 | directiveValue; |
| 9547 | |
| 9548 | // executes all directives on the current element |
| 9549 | for (var i = 0, ii = directives.length; i < ii; i++) { |
| 9550 | directive = directives[i]; |
| 9551 | var attrStart = directive.$$start; |
| 9552 | var attrEnd = directive.$$end; |
| 9553 | |
| 9554 | // collect multiblock sections |
| 9555 | if (attrStart) { |
| 9556 | $compileNode = groupScan(compileNode, attrStart, attrEnd); |
| 9557 | } |
| 9558 | $template = undefined; |
| 9559 | |
| 9560 | if (terminalPriority > directive.priority) { |
| 9561 | break; // prevent further processing of directives |
| 9562 | } |
| 9563 | |
| 9564 | directiveValue = directive.scope; |
| 9565 | |
| 9566 | if (directiveValue) { |
| 9567 | |
| 9568 | // skip the check for directives with async templates, we'll check the derived sync |
| 9569 | // directive when the template arrives |
| 9570 | if (!directive.templateUrl) { |
| 9571 | if (isObject(directiveValue)) { |
| 9572 | // This directive is trying to add an isolated scope. |
| 9573 | // Check that there is no scope of any kind already |
| 9574 | assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective, |
| 9575 | directive, $compileNode); |
| 9576 | newIsolateScopeDirective = directive; |
| 9577 | } else { |
| 9578 | // This directive is trying to add a child scope. |
| 9579 | // Check that there is no isolated scope already |
| 9580 | assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive, |
no test coverage detected