* 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)
| 6265 | * @returns {Function} linkFn |
| 6266 | */ |
| 6267 | function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, |
| 6268 | jqCollection, originalReplaceDirective, preLinkFns, postLinkFns, |
| 6269 | previousCompileContext) { |
| 6270 | previousCompileContext = previousCompileContext || {}; |
| 6271 | |
| 6272 | var terminalPriority = -Number.MAX_VALUE, |
| 6273 | newScopeDirective, |
| 6274 | controllerDirectives = previousCompileContext.controllerDirectives, |
| 6275 | newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective, |
| 6276 | templateDirective = previousCompileContext.templateDirective, |
| 6277 | nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective, |
| 6278 | hasTranscludeDirective = false, |
| 6279 | hasTemplate = false, |
| 6280 | hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective, |
| 6281 | $compileNode = templateAttrs.$$element = jqLite(compileNode), |
| 6282 | directive, |
| 6283 | directiveName, |
| 6284 | $template, |
| 6285 | replaceDirective = originalReplaceDirective, |
| 6286 | childTranscludeFn = transcludeFn, |
| 6287 | linkFn, |
| 6288 | directiveValue; |
| 6289 | |
| 6290 | // executes all directives on the current element |
| 6291 | for(var i = 0, ii = directives.length; i < ii; i++) { |
| 6292 | directive = directives[i]; |
| 6293 | var attrStart = directive.$$start; |
| 6294 | var attrEnd = directive.$$end; |
| 6295 | |
| 6296 | // collect multiblock sections |
| 6297 | if (attrStart) { |
| 6298 | $compileNode = groupScan(compileNode, attrStart, attrEnd); |
| 6299 | } |
| 6300 | $template = undefined; |
| 6301 | |
| 6302 | if (terminalPriority > directive.priority) { |
| 6303 | break; // prevent further processing of directives |
| 6304 | } |
| 6305 | |
| 6306 | if (directiveValue = directive.scope) { |
| 6307 | newScopeDirective = newScopeDirective || directive; |
| 6308 | |
| 6309 | // skip the check for directives with async templates, we'll check the derived sync |
| 6310 | // directive when the template arrives |
| 6311 | if (!directive.templateUrl) { |
| 6312 | assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive, |
| 6313 | $compileNode); |
| 6314 | if (isObject(directiveValue)) { |
| 6315 | newIsolateScopeDirective = directive; |
| 6316 | } |
| 6317 | } |
| 6318 | } |
| 6319 | |
| 6320 | directiveName = directive.name; |
| 6321 | |
| 6322 | if (!directive.templateUrl && directive.controller) { |
| 6323 | directiveValue = directive.controller; |
| 6324 | controllerDirectives = controllerDirectives || {}; |
no test coverage detected