* 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)
| 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 || {}; |
no test coverage detected