* Compile function matches each node in nodeList against the directives. Once all directives * for a particular node are collected their compile functions are executed. The compile * functions return values - the linking functions - are combined into a composite linking * function, wh
(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,
previousCompileContext)
| 9247 | * @returns {Function} A composite linking function of all of the matched directives or null. |
| 9248 | */ |
| 9249 | function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective, |
| 9250 | previousCompileContext) { |
| 9251 | var linkFns = [], |
| 9252 | // `nodeList` can be either an element's `.childNodes` (live NodeList) |
| 9253 | // or a jqLite/jQuery collection or an array |
| 9254 | notLiveList = isArray(nodeList) || (nodeList instanceof jqLite), |
| 9255 | attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound; |
| 9256 | |
| 9257 | |
| 9258 | for (var i = 0; i < nodeList.length; i++) { |
| 9259 | attrs = new Attributes(); |
| 9260 | |
| 9261 | // Support: IE 11 only |
| 9262 | // Workaround for #11781 and #14924 |
| 9263 | if (msie === 11) { |
| 9264 | mergeConsecutiveTextNodes(nodeList, i, notLiveList); |
| 9265 | } |
| 9266 | |
| 9267 | // We must always refer to `nodeList[i]` hereafter, |
| 9268 | // since the nodes can be replaced underneath us. |
| 9269 | directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined, |
| 9270 | ignoreDirective); |
| 9271 | |
| 9272 | nodeLinkFn = (directives.length) |
| 9273 | ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement, |
| 9274 | null, [], [], previousCompileContext) |
| 9275 | : null; |
| 9276 | |
| 9277 | if (nodeLinkFn && nodeLinkFn.scope) { |
| 9278 | compile.$$addScopeClass(attrs.$$element); |
| 9279 | } |
| 9280 | |
| 9281 | childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || |
| 9282 | !(childNodes = nodeList[i].childNodes) || |
| 9283 | !childNodes.length) |
| 9284 | ? null |
| 9285 | : compileNodes(childNodes, |
| 9286 | nodeLinkFn ? ( |
| 9287 | (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement) |
| 9288 | && nodeLinkFn.transclude) : transcludeFn); |
| 9289 | |
| 9290 | if (nodeLinkFn || childLinkFn) { |
| 9291 | linkFns.push(i, nodeLinkFn, childLinkFn); |
| 9292 | linkFnFound = true; |
| 9293 | nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn; |
| 9294 | } |
| 9295 | |
| 9296 | //use the previous context only for the first element in the virtual group |
| 9297 | previousCompileContext = null; |
| 9298 | } |
| 9299 | |
| 9300 | // return a linking function if we have found anything, null otherwise |
| 9301 | return linkFnFound ? compositeLinkFn : null; |
| 9302 | |
| 9303 | function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) { |
| 9304 | var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn; |
| 9305 | var stableNodeList; |
| 9306 |
no test coverage detected