MCPcopy
hub / github.com/angular-ui/ui-grid / applyDirectivesToNode

Function applyDirectivesToNode

lib/test/angular/1.8.0/angular.js:10206–10707  ·  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

10204 * @returns {Function} linkFn
10205 */
10206 function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
10207 jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
10208 previousCompileContext) {
10209 previousCompileContext = previousCompileContext || {};
10210
10211 var terminalPriority = -Number.MAX_VALUE,
10212 newScopeDirective = previousCompileContext.newScopeDirective,
10213 controllerDirectives = previousCompileContext.controllerDirectives,
10214 newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
10215 templateDirective = previousCompileContext.templateDirective,
10216 nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
10217 hasTranscludeDirective = false,
10218 hasTemplate = false,
10219 hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
10220 $compileNode = templateAttrs.$$element = jqLite(compileNode),
10221 directive,
10222 directiveName,
10223 $template,
10224 replaceDirective = originalReplaceDirective,
10225 childTranscludeFn = transcludeFn,
10226 linkFn,
10227 didScanForMultipleTransclusion = false,
10228 mightHaveMultipleTransclusionError = false,
10229 directiveValue;
10230
10231 // executes all directives on the current element
10232 for (var i = 0, ii = directives.length; i < ii; i++) {
10233 directive = directives[i];
10234 var attrStart = directive.$$start;
10235 var attrEnd = directive.$$end;
10236
10237 // collect multiblock sections
10238 if (attrStart) {
10239 $compileNode = groupScan(compileNode, attrStart, attrEnd);
10240 }
10241 $template = undefined;
10242
10243 if (terminalPriority > directive.priority) {
10244 break; // prevent further processing of directives
10245 }
10246
10247 directiveValue = directive.scope;
10248
10249 if (directiveValue) {
10250
10251 // skip the check for directives with async templates, we'll check the derived sync
10252 // directive when the template arrives
10253 if (!directive.templateUrl) {
10254 if (isObject(directiveValue)) {
10255 // This directive is trying to add an isolated scope.
10256 // Check that there is no scope of any kind already
10257 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,
10258 directive, $compileNode);
10259 newIsolateScopeDirective = directive;
10260 } else {
10261 // This directive is trying to add a child scope.
10262 // Check that there is no isolated scope already
10263 assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,

Callers 2

compileNodesFunction · 0.70
compileTemplateUrlFunction · 0.70

Calls 15

groupScanFunction · 0.70
isObjectFunction · 0.70
assertNoDuplicateFunction · 0.70
createMapFunction · 0.70
replaceWithFunction · 0.70
sliceArgsFunction · 0.70
compilationGeneratorFunction · 0.70
jqLiteCloneFunction · 0.70
forEachFunction · 0.70
directiveNormalizeFunction · 0.70
nodeName_Function · 0.70
isFunctionFunction · 0.70

Tested by

no test coverage detected