* 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)
| 5766 | * @returns linkFn |
| 5767 | */ |
| 5768 | function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, |
| 5769 | jqCollection, originalReplaceDirective, preLinkFns, postLinkFns, |
| 5770 | previousCompileContext) { |
| 5771 | previousCompileContext = previousCompileContext || {}; |
| 5772 | |
| 5773 | var terminalPriority = -Number.MAX_VALUE, |
| 5774 | newScopeDirective, |
| 5775 | controllerDirectives = previousCompileContext.controllerDirectives, |
| 5776 | newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective, |
| 5777 | templateDirective = previousCompileContext.templateDirective, |
| 5778 | nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective, |
| 5779 | hasTranscludeDirective = false, |
| 5780 | hasElementTranscludeDirective = false, |
| 5781 | $compileNode = templateAttrs.$$element = jqLite(compileNode), |
| 5782 | directive, |
| 5783 | directiveName, |
| 5784 | $template, |
| 5785 | replaceDirective = originalReplaceDirective, |
| 5786 | childTranscludeFn = transcludeFn, |
| 5787 | linkFn, |
| 5788 | directiveValue; |
| 5789 | |
| 5790 | // executes all directives on the current element |
| 5791 | for(var i = 0, ii = directives.length; i < ii; i++) { |
| 5792 | directive = directives[i]; |
| 5793 | var attrStart = directive.$$start; |
| 5794 | var attrEnd = directive.$$end; |
| 5795 | |
| 5796 | // collect multiblock sections |
| 5797 | if (attrStart) { |
| 5798 | $compileNode = groupScan(compileNode, attrStart, attrEnd); |
| 5799 | } |
| 5800 | $template = undefined; |
| 5801 | |
| 5802 | if (terminalPriority > directive.priority) { |
| 5803 | break; // prevent further processing of directives |
| 5804 | } |
| 5805 | |
| 5806 | if (directiveValue = directive.scope) { |
| 5807 | newScopeDirective = newScopeDirective || directive; |
| 5808 | |
| 5809 | // skip the check for directives with async templates, we'll check the derived sync |
| 5810 | // directive when the template arrives |
| 5811 | if (!directive.templateUrl) { |
| 5812 | assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive, |
| 5813 | $compileNode); |
| 5814 | if (isObject(directiveValue)) { |
| 5815 | newIsolateScopeDirective = directive; |
| 5816 | } |
| 5817 | } |
| 5818 | } |
| 5819 | |
| 5820 | directiveName = directive.name; |
| 5821 | |
| 5822 | if (!directive.templateUrl && directive.controller) { |
| 5823 | directiveValue = directive.controller; |
| 5824 | controllerDirectives = controllerDirectives || {}; |
| 5825 | assertNoDuplicate("'" + directiveName + "' controller", |
no test coverage detected
searching dependent graphs…