* 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)
| 9208 | * @returns {Function} A composite linking function of all of the matched directives or null. |
| 9209 | */ |
| 9210 | function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective, |
| 9211 | previousCompileContext) { |
| 9212 | var linkFns = [], |
| 9213 | // `nodeList` can be either an element's `.childNodes` (live NodeList) |
| 9214 | // or a jqLite/jQuery collection or an array |
| 9215 | notLiveList = isArray(nodeList) || (nodeList instanceof jqLite), |
| 9216 | attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound; |
| 9217 | |
| 9218 | |
| 9219 | for (var i = 0; i < nodeList.length; i++) { |
| 9220 | attrs = new Attributes(); |
| 9221 | |
| 9222 | // Support: IE 11 only |
| 9223 | // Workaround for #11781 and #14924 |
| 9224 | if (msie === 11) { |
| 9225 | mergeConsecutiveTextNodes(nodeList, i, notLiveList); |
| 9226 | } |
| 9227 | |
| 9228 | // We must always refer to `nodeList[i]` hereafter, |
| 9229 | // since the nodes can be replaced underneath us. |
| 9230 | directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined, |
| 9231 | ignoreDirective); |
| 9232 | |
| 9233 | nodeLinkFn = (directives.length) |
| 9234 | ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement, |
| 9235 | null, [], [], previousCompileContext) |
| 9236 | : null; |
| 9237 | |
| 9238 | if (nodeLinkFn && nodeLinkFn.scope) { |
| 9239 | compile.$$addScopeClass(attrs.$$element); |
| 9240 | } |
| 9241 | |
| 9242 | childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || |
| 9243 | !(childNodes = nodeList[i].childNodes) || |
| 9244 | !childNodes.length) |
| 9245 | ? null |
| 9246 | : compileNodes(childNodes, |
| 9247 | nodeLinkFn ? ( |
| 9248 | (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement) |
| 9249 | && nodeLinkFn.transclude) : transcludeFn); |
| 9250 | |
| 9251 | if (nodeLinkFn || childLinkFn) { |
| 9252 | linkFns.push(i, nodeLinkFn, childLinkFn); |
| 9253 | linkFnFound = true; |
| 9254 | nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn; |
| 9255 | } |
| 9256 | |
| 9257 | //use the previous context only for the first element in the virtual group |
| 9258 | previousCompileContext = null; |
| 9259 | } |
| 9260 | |
| 9261 | // return a linking function if we have found anything, null otherwise |
| 9262 | return linkFnFound ? compositeLinkFn : null; |
| 9263 | |
| 9264 | function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) { |
| 9265 | var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn; |
| 9266 | var stableNodeList; |
| 9267 |
no test coverage detected