(scope, nodeList, $rootElement, parentBoundTranscludeFn)
| 9851 | return linkFnFound ? compositeLinkFn : null; |
| 9852 | |
| 9853 | function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) { |
| 9854 | var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn; |
| 9855 | var stableNodeList; |
| 9856 | |
| 9857 | |
| 9858 | if (nodeLinkFnFound) { |
| 9859 | // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our |
| 9860 | // offsets don't get screwed up |
| 9861 | var nodeListLength = nodeList.length; |
| 9862 | stableNodeList = new Array(nodeListLength); |
| 9863 | |
| 9864 | // create a sparse array by only copying the elements which have a linkFn |
| 9865 | for (i = 0; i < linkFns.length; i += 3) { |
| 9866 | idx = linkFns[i]; |
| 9867 | stableNodeList[idx] = nodeList[idx]; |
| 9868 | } |
| 9869 | } else { |
| 9870 | stableNodeList = nodeList; |
| 9871 | } |
| 9872 | |
| 9873 | for (i = 0, ii = linkFns.length; i < ii;) { |
| 9874 | node = stableNodeList[linkFns[i++]]; |
| 9875 | nodeLinkFn = linkFns[i++]; |
| 9876 | childLinkFn = linkFns[i++]; |
| 9877 | |
| 9878 | if (nodeLinkFn) { |
| 9879 | if (nodeLinkFn.scope) { |
| 9880 | childScope = scope.$new(); |
| 9881 | compile.$$addScopeInfo(jqLite(node), childScope); |
| 9882 | } else { |
| 9883 | childScope = scope; |
| 9884 | } |
| 9885 | |
| 9886 | if (nodeLinkFn.transcludeOnThisElement) { |
| 9887 | childBoundTranscludeFn = createBoundTranscludeFn( |
| 9888 | scope, nodeLinkFn.transclude, parentBoundTranscludeFn); |
| 9889 | |
| 9890 | } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) { |
| 9891 | childBoundTranscludeFn = parentBoundTranscludeFn; |
| 9892 | |
| 9893 | } else if (!parentBoundTranscludeFn && transcludeFn) { |
| 9894 | childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn); |
| 9895 | |
| 9896 | } else { |
| 9897 | childBoundTranscludeFn = null; |
| 9898 | } |
| 9899 | |
| 9900 | nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn); |
| 9901 | |
| 9902 | } else if (childLinkFn) { |
| 9903 | childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn); |
| 9904 | } |
| 9905 | } |
| 9906 | } |
| 9907 | } |
| 9908 | |
| 9909 | function mergeConsecutiveTextNodes(nodeList, idx, notLiveList) { |
no test coverage detected