(scope, nodeList, $rootElement, parentBoundTranscludeFn)
| 8761 | return linkFnFound ? compositeLinkFn : null; |
| 8762 | |
| 8763 | function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) { |
| 8764 | var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn; |
| 8765 | var stableNodeList; |
| 8766 | |
| 8767 | |
| 8768 | if (nodeLinkFnFound) { |
| 8769 | // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our |
| 8770 | // offsets don't get screwed up |
| 8771 | var nodeListLength = nodeList.length; |
| 8772 | stableNodeList = new Array(nodeListLength); |
| 8773 | |
| 8774 | // create a sparse array by only copying the elements which have a linkFn |
| 8775 | for (i = 0; i < linkFns.length; i += 3) { |
| 8776 | idx = linkFns[i]; |
| 8777 | stableNodeList[idx] = nodeList[idx]; |
| 8778 | } |
| 8779 | } else { |
| 8780 | stableNodeList = nodeList; |
| 8781 | } |
| 8782 | |
| 8783 | for (i = 0, ii = linkFns.length; i < ii;) { |
| 8784 | node = stableNodeList[linkFns[i++]]; |
| 8785 | nodeLinkFn = linkFns[i++]; |
| 8786 | childLinkFn = linkFns[i++]; |
| 8787 | |
| 8788 | if (nodeLinkFn) { |
| 8789 | if (nodeLinkFn.scope) { |
| 8790 | childScope = scope.$new(); |
| 8791 | compile.$$addScopeInfo(jqLite(node), childScope); |
| 8792 | } else { |
| 8793 | childScope = scope; |
| 8794 | } |
| 8795 | |
| 8796 | if (nodeLinkFn.transcludeOnThisElement) { |
| 8797 | childBoundTranscludeFn = createBoundTranscludeFn( |
| 8798 | scope, nodeLinkFn.transclude, parentBoundTranscludeFn); |
| 8799 | |
| 8800 | } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) { |
| 8801 | childBoundTranscludeFn = parentBoundTranscludeFn; |
| 8802 | |
| 8803 | } else if (!parentBoundTranscludeFn && transcludeFn) { |
| 8804 | childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn); |
| 8805 | |
| 8806 | } else { |
| 8807 | childBoundTranscludeFn = null; |
| 8808 | } |
| 8809 | |
| 8810 | nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn); |
| 8811 | |
| 8812 | } else if (childLinkFn) { |
| 8813 | childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn); |
| 8814 | } |
| 8815 | } |
| 8816 | } |
| 8817 | } |
| 8818 | |
| 8819 | function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) { |
no test coverage detected