MCPcopy
hub / github.com/binux/qiandao / applyDirectivesToNode

Function applyDirectivesToNode

web/static/components/angularjs/angular.js:6267–6700  ·  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

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 || {};

Callers 2

compileNodesFunction · 0.85
compileTemplateUrlFunction · 0.85

Calls 15

groupScanFunction · 0.85
assertNoDuplicateFunction · 0.85
replaceWithFunction · 0.85
sliceArgsFunction · 0.85
compileFunction · 0.85
jqLiteCloneFunction · 0.85
jqLiteIsTextNodeFunction · 0.85
collectDirectivesFunction · 0.85
markDirectivesAsIsolateFunction · 0.85
mergeTemplateAttributesFunction · 0.85
compileTemplateUrlFunction · 0.85
addLinkFnsFunction · 0.85

Tested by

no test coverage detected