(scope, nodeList, $rootElement, parentBoundTranscludeFn)
| 7926 | return linkFnFound ? compositeLinkFn : null; |
| 7927 | |
| 7928 | function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) { |
| 7929 | var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn; |
| 7930 | var stableNodeList; |
| 7931 | |
| 7932 | |
| 7933 | if (nodeLinkFnFound) { |
| 7934 | // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our |
| 7935 | // offsets don't get screwed up |
| 7936 | var nodeListLength = nodeList.length; |
| 7937 | stableNodeList = new Array(nodeListLength); |
| 7938 | |
| 7939 | // create a sparse array by only copying the elements which have a linkFn |
| 7940 | for (i = 0; i < linkFns.length; i+=3) { |
| 7941 | idx = linkFns[i]; |
| 7942 | stableNodeList[idx] = nodeList[idx]; |
| 7943 | } |
| 7944 | } else { |
| 7945 | stableNodeList = nodeList; |
| 7946 | } |
| 7947 | |
| 7948 | for (i = 0, ii = linkFns.length; i < ii;) { |
| 7949 | node = stableNodeList[linkFns[i++]]; |
| 7950 | nodeLinkFn = linkFns[i++]; |
| 7951 | childLinkFn = linkFns[i++]; |
| 7952 | |
| 7953 | if (nodeLinkFn) { |
| 7954 | if (nodeLinkFn.scope) { |
| 7955 | childScope = scope.$new(); |
| 7956 | compile.$$addScopeInfo(jqLite(node), childScope); |
| 7957 | } else { |
| 7958 | childScope = scope; |
| 7959 | } |
| 7960 | |
| 7961 | if (nodeLinkFn.transcludeOnThisElement) { |
| 7962 | childBoundTranscludeFn = createBoundTranscludeFn( |
| 7963 | scope, nodeLinkFn.transclude, parentBoundTranscludeFn); |
| 7964 | |
| 7965 | } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) { |
| 7966 | childBoundTranscludeFn = parentBoundTranscludeFn; |
| 7967 | |
| 7968 | } else if (!parentBoundTranscludeFn && transcludeFn) { |
| 7969 | childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn); |
| 7970 | |
| 7971 | } else { |
| 7972 | childBoundTranscludeFn = null; |
| 7973 | } |
| 7974 | |
| 7975 | nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn); |
| 7976 | |
| 7977 | } else if (childLinkFn) { |
| 7978 | childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn); |
| 7979 | } |
| 7980 | } |
| 7981 | } |
| 7982 | } |
| 7983 | |
| 7984 | function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) { |
no test coverage detected