* 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)
| 7339 | * @returns {Function} linkFn |
| 7340 | */ |
| 7341 | function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, |
| 7342 | jqCollection, originalReplaceDirective, preLinkFns, postLinkFns, |
| 7343 | previousCompileContext) { |
| 7344 | previousCompileContext = previousCompileContext || {}; |
| 7345 | |
| 7346 | var terminalPriority = -Number.MAX_VALUE, |
| 7347 | newScopeDirective, |
| 7348 | controllerDirectives = previousCompileContext.controllerDirectives, |
| 7349 | controllers, |
| 7350 | newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective, |
| 7351 | templateDirective = previousCompileContext.templateDirective, |
| 7352 | nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective, |
| 7353 | hasTranscludeDirective = false, |
| 7354 | hasTemplate = false, |
| 7355 | hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective, |
| 7356 | $compileNode = templateAttrs.$$element = jqLite(compileNode), |
| 7357 | directive, |
| 7358 | directiveName, |
| 7359 | $template, |
| 7360 | replaceDirective = originalReplaceDirective, |
| 7361 | childTranscludeFn = transcludeFn, |
| 7362 | linkFn, |
| 7363 | directiveValue; |
| 7364 | |
| 7365 | // executes all directives on the current element |
| 7366 | for (var i = 0, ii = directives.length; i < ii; i++) { |
| 7367 | directive = directives[i]; |
| 7368 | var attrStart = directive.$$start; |
| 7369 | var attrEnd = directive.$$end; |
| 7370 | |
| 7371 | // collect multiblock sections |
| 7372 | if (attrStart) { |
| 7373 | $compileNode = groupScan(compileNode, attrStart, attrEnd); |
| 7374 | } |
| 7375 | $template = undefined; |
| 7376 | |
| 7377 | if (terminalPriority > directive.priority) { |
| 7378 | break; // prevent further processing of directives |
| 7379 | } |
| 7380 | |
| 7381 | if (directiveValue = directive.scope) { |
| 7382 | |
| 7383 | // skip the check for directives with async templates, we'll check the derived sync |
| 7384 | // directive when the template arrives |
| 7385 | if (!directive.templateUrl) { |
| 7386 | if (isObject(directiveValue)) { |
| 7387 | // This directive is trying to add an isolated scope. |
| 7388 | // Check that there is no scope of any kind already |
| 7389 | assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective, |
| 7390 | directive, $compileNode); |
| 7391 | newIsolateScopeDirective = directive; |
| 7392 | } else { |
| 7393 | // This directive is trying to add a child scope. |
| 7394 | // Check that there is no isolated scope already |
| 7395 | assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive, |
| 7396 | $compileNode); |
| 7397 | } |
| 7398 | } |
no test coverage detected