* 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)
| 9732 | * @returns {Function} A composite linking function of all of the matched directives or null. |
| 9733 | */ |
| 9734 | function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective, |
| 9735 | previousCompileContext) { |
| 9736 | var linkFns = [], |
| 9737 | // `nodeList` can be either an element's `.childNodes` (live NodeList) |
| 9738 | // or a jqLite/jQuery collection or an array |
| 9739 | notLiveList = isArray(nodeList) || (nodeList instanceof jqLite), |
| 9740 | attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound; |
| 9741 | |
| 9742 | |
| 9743 | for (var i = 0; i < nodeList.length; i++) { |
| 9744 | attrs = new Attributes(); |
| 9745 | |
| 9746 | // Support: IE 11 only |
| 9747 | // Workaround for #11781 and #14924 |
| 9748 | if (msie === 11) { |
| 9749 | mergeConsecutiveTextNodes(nodeList, i, notLiveList); |
| 9750 | } |
| 9751 | |
| 9752 | // We must always refer to `nodeList[i]` hereafter, |
| 9753 | // since the nodes can be replaced underneath us. |
| 9754 | directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined, |
| 9755 | ignoreDirective); |
| 9756 | |
| 9757 | nodeLinkFn = (directives.length) |
| 9758 | ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement, |
| 9759 | null, [], [], previousCompileContext) |
| 9760 | : null; |
| 9761 | |
| 9762 | if (nodeLinkFn && nodeLinkFn.scope) { |
| 9763 | compile.$$addScopeClass(attrs.$$element); |
| 9764 | } |
| 9765 | |
| 9766 | childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || |
| 9767 | !(childNodes = nodeList[i].childNodes) || |
| 9768 | !childNodes.length) |
| 9769 | ? null |
| 9770 | : compileNodes(childNodes, |
| 9771 | nodeLinkFn ? ( |
| 9772 | (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement) |
| 9773 | && nodeLinkFn.transclude) : transcludeFn); |
| 9774 | |
| 9775 | if (nodeLinkFn || childLinkFn) { |
| 9776 | linkFns.push(i, nodeLinkFn, childLinkFn); |
| 9777 | linkFnFound = true; |
| 9778 | nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn; |
| 9779 | } |
| 9780 | |
| 9781 | //use the previous context only for the first element in the virtual group |
| 9782 | previousCompileContext = null; |
| 9783 | } |
| 9784 | |
| 9785 | // return a linking function if we have found anything, null otherwise |
| 9786 | return linkFnFound ? compositeLinkFn : null; |
| 9787 | |
| 9788 | function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) { |
| 9789 | var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn; |
| 9790 | var stableNodeList; |
| 9791 |
no test coverage detected