* 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)
| 9137 | * @returns {Function} A composite linking function of all of the matched directives or null. |
| 9138 | */ |
| 9139 | function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective, |
| 9140 | previousCompileContext) { |
| 9141 | var linkFns = [], |
| 9142 | // `nodeList` can be either an element's `.childNodes` (live NodeList) |
| 9143 | // or a jqLite/jQuery collection or an array |
| 9144 | notLiveList = isArray(nodeList) || (nodeList instanceof jqLite), |
| 9145 | attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound; |
| 9146 | |
| 9147 | |
| 9148 | for (var i = 0; i < nodeList.length; i++) { |
| 9149 | attrs = new Attributes(); |
| 9150 | |
| 9151 | // Support: IE 11 only |
| 9152 | // Workaround for #11781 and #14924 |
| 9153 | if (msie === 11) { |
| 9154 | mergeConsecutiveTextNodes(nodeList, i, notLiveList); |
| 9155 | } |
| 9156 | |
| 9157 | // We must always refer to `nodeList[i]` hereafter, |
| 9158 | // since the nodes can be replaced underneath us. |
| 9159 | directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined, |
| 9160 | ignoreDirective); |
| 9161 | |
| 9162 | nodeLinkFn = (directives.length) |
| 9163 | ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement, |
| 9164 | null, [], [], previousCompileContext) |
| 9165 | : null; |
| 9166 | |
| 9167 | if (nodeLinkFn && nodeLinkFn.scope) { |
| 9168 | compile.$$addScopeClass(attrs.$$element); |
| 9169 | } |
| 9170 | |
| 9171 | childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || |
| 9172 | !(childNodes = nodeList[i].childNodes) || |
| 9173 | !childNodes.length) |
| 9174 | ? null |
| 9175 | : compileNodes(childNodes, |
| 9176 | nodeLinkFn ? ( |
| 9177 | (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement) |
| 9178 | && nodeLinkFn.transclude) : transcludeFn); |
| 9179 | |
| 9180 | if (nodeLinkFn || childLinkFn) { |
| 9181 | linkFns.push(i, nodeLinkFn, childLinkFn); |
| 9182 | linkFnFound = true; |
| 9183 | nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn; |
| 9184 | } |
| 9185 | |
| 9186 | //use the previous context only for the first element in the virtual group |
| 9187 | previousCompileContext = null; |
| 9188 | } |
| 9189 | |
| 9190 | // return a linking function if we have found anything, null otherwise |
| 9191 | return linkFnFound ? compositeLinkFn : null; |
| 9192 | |
| 9193 | function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) { |
| 9194 | var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn; |
| 9195 | var stableNodeList; |
| 9196 |
no test coverage detected