(scope, nodeList, $rootElement, parentBoundTranscludeFn)
| 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 | |
| 9792 | |
| 9793 | if (nodeLinkFnFound) { |
| 9794 | // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our |
| 9795 | // offsets don't get screwed up |
| 9796 | var nodeListLength = nodeList.length; |
| 9797 | stableNodeList = new Array(nodeListLength); |
| 9798 | |
| 9799 | // create a sparse array by only copying the elements which have a linkFn |
| 9800 | for (i = 0; i < linkFns.length; i += 3) { |
| 9801 | idx = linkFns[i]; |
| 9802 | stableNodeList[idx] = nodeList[idx]; |
| 9803 | } |
| 9804 | } else { |
| 9805 | stableNodeList = nodeList; |
| 9806 | } |
| 9807 | |
| 9808 | for (i = 0, ii = linkFns.length; i < ii;) { |
| 9809 | node = stableNodeList[linkFns[i++]]; |
| 9810 | nodeLinkFn = linkFns[i++]; |
| 9811 | childLinkFn = linkFns[i++]; |
| 9812 | |
| 9813 | if (nodeLinkFn) { |
| 9814 | if (nodeLinkFn.scope) { |
| 9815 | childScope = scope.$new(); |
| 9816 | compile.$$addScopeInfo(jqLite(node), childScope); |
| 9817 | } else { |
| 9818 | childScope = scope; |
| 9819 | } |
| 9820 | |
| 9821 | if (nodeLinkFn.transcludeOnThisElement) { |
| 9822 | childBoundTranscludeFn = createBoundTranscludeFn( |
| 9823 | scope, nodeLinkFn.transclude, parentBoundTranscludeFn); |
| 9824 | |
| 9825 | } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) { |
| 9826 | childBoundTranscludeFn = parentBoundTranscludeFn; |
| 9827 | |
| 9828 | } else if (!parentBoundTranscludeFn && transcludeFn) { |
| 9829 | childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn); |
| 9830 | |
| 9831 | } else { |
| 9832 | childBoundTranscludeFn = null; |
| 9833 | } |
| 9834 | |
| 9835 | nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn); |
| 9836 | |
| 9837 | } else if (childLinkFn) { |
| 9838 | childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn); |
| 9839 | } |
| 9840 | } |
| 9841 | } |
| 9842 | } |
| 9843 | |
| 9844 | function mergeConsecutiveTextNodes(nodeList, idx, notLiveList) { |
no test coverage detected