* 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)
| 7748 | * @returns {Function} linkFn |
| 7749 | */ |
| 7750 | function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, |
| 7751 | jqCollection, originalReplaceDirective, preLinkFns, postLinkFns, |
| 7752 | previousCompileContext) { |
| 7753 | previousCompileContext = previousCompileContext || {}; |
| 7754 | |
| 7755 | var terminalPriority = -Number.MAX_VALUE, |
| 7756 | newScopeDirective = previousCompileContext.newScopeDirective, |
| 7757 | controllerDirectives = previousCompileContext.controllerDirectives, |
| 7758 | newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective, |
| 7759 | templateDirective = previousCompileContext.templateDirective, |
| 7760 | nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective, |
| 7761 | hasTranscludeDirective = false, |
| 7762 | hasTemplate = false, |
| 7763 | hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective, |
| 7764 | $compileNode = templateAttrs.$$element = jqLite(compileNode), |
| 7765 | directive, |
| 7766 | directiveName, |
| 7767 | $template, |
| 7768 | replaceDirective = originalReplaceDirective, |
| 7769 | childTranscludeFn = transcludeFn, |
| 7770 | linkFn, |
| 7771 | directiveValue; |
| 7772 | |
| 7773 | // executes all directives on the current element |
| 7774 | for (var i = 0, ii = directives.length; i < ii; i++) { |
| 7775 | directive = directives[i]; |
| 7776 | var attrStart = directive.$$start; |
| 7777 | var attrEnd = directive.$$end; |
| 7778 | |
| 7779 | // collect multiblock sections |
| 7780 | if (attrStart) { |
| 7781 | $compileNode = groupScan(compileNode, attrStart, attrEnd); |
| 7782 | } |
| 7783 | $template = undefined; |
| 7784 | |
| 7785 | if (terminalPriority > directive.priority) { |
| 7786 | break; // prevent further processing of directives |
| 7787 | } |
| 7788 | |
| 7789 | if (directiveValue = directive.scope) { |
| 7790 | |
| 7791 | // skip the check for directives with async templates, we'll check the derived sync |
| 7792 | // directive when the template arrives |
| 7793 | if (!directive.templateUrl) { |
| 7794 | if (isObject(directiveValue)) { |
| 7795 | // This directive is trying to add an isolated scope. |
| 7796 | // Check that there is no scope of any kind already |
| 7797 | assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective, |
| 7798 | directive, $compileNode); |
| 7799 | newIsolateScopeDirective = directive; |
| 7800 | } else { |
| 7801 | // This directive is trying to add a child scope. |
| 7802 | // Check that there is no isolated scope already |
| 7803 | assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive, |
| 7804 | $compileNode); |
| 7805 | } |
| 7806 | } |
| 7807 |
no test coverage detected