MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / applyDirectivesToNode

Function applyDirectivesToNode

code/songhop/www/lib/angular/angular.js:7256–7736  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

7254 * @returns {Function} linkFn
7255 */
7256 function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
7257 jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
7258 previousCompileContext) {
7259 previousCompileContext = previousCompileContext || {};
7260
7261 var terminalPriority = -Number.MAX_VALUE,
7262 newScopeDirective,
7263 controllerDirectives = previousCompileContext.controllerDirectives,
7264 controllers,
7265 newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
7266 templateDirective = previousCompileContext.templateDirective,
7267 nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
7268 hasTranscludeDirective = false,
7269 hasTemplate = false,
7270 hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
7271 $compileNode = templateAttrs.$$element = jqLite(compileNode),
7272 directive,
7273 directiveName,
7274 $template,
7275 replaceDirective = originalReplaceDirective,
7276 childTranscludeFn = transcludeFn,
7277 linkFn,
7278 directiveValue;
7279
7280 // executes all directives on the current element
7281 for (var i = 0, ii = directives.length; i < ii; i++) {
7282 directive = directives[i];
7283 var attrStart = directive.$$start;
7284 var attrEnd = directive.$$end;
7285
7286 // collect multiblock sections
7287 if (attrStart) {
7288 $compileNode = groupScan(compileNode, attrStart, attrEnd);
7289 }
7290 $template = undefined;
7291
7292 if (terminalPriority > directive.priority) {
7293 break; // prevent further processing of directives
7294 }
7295
7296 if (directiveValue = directive.scope) {
7297
7298 // skip the check for directives with async templates, we'll check the derived sync
7299 // directive when the template arrives
7300 if (!directive.templateUrl) {
7301 if (isObject(directiveValue)) {
7302 // This directive is trying to add an isolated scope.
7303 // Check that there is no scope of any kind already
7304 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,
7305 directive, $compileNode);
7306 newIsolateScopeDirective = directive;
7307 } else {
7308 // This directive is trying to add a child scope.
7309 // Check that there is no isolated scope already
7310 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,
7311 $compileNode);
7312 }
7313 }

Callers 2

compileNodesFunction · 0.70
compileTemplateUrlFunction · 0.70

Calls 15

concatMethod · 0.80
compileMethod · 0.80
groupScanFunction · 0.70
isObjectFunction · 0.70
assertNoDuplicateFunction · 0.70
replaceWithFunction · 0.70
sliceArgsFunction · 0.70
compileFunction · 0.70
jqLiteCloneFunction · 0.70
isFunctionFunction · 0.70
jqLiteIsTextNodeFunction · 0.70
removeCommentsFunction · 0.70

Tested by

no test coverage detected