(scope, nodeList, $rootElement, parentBoundTranscludeFn)
| 9301 | return linkFnFound ? compositeLinkFn : null; |
| 9302 | |
| 9303 | function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) { |
| 9304 | var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn; |
| 9305 | var stableNodeList; |
| 9306 | |
| 9307 | |
| 9308 | if (nodeLinkFnFound) { |
| 9309 | // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our |
| 9310 | // offsets don't get screwed up |
| 9311 | var nodeListLength = nodeList.length; |
| 9312 | stableNodeList = new Array(nodeListLength); |
| 9313 | |
| 9314 | // create a sparse array by only copying the elements which have a linkFn |
| 9315 | for (i = 0; i < linkFns.length; i += 3) { |
| 9316 | idx = linkFns[i]; |
| 9317 | stableNodeList[idx] = nodeList[idx]; |
| 9318 | } |
| 9319 | } else { |
| 9320 | stableNodeList = nodeList; |
| 9321 | } |
| 9322 | |
| 9323 | for (i = 0, ii = linkFns.length; i < ii;) { |
| 9324 | node = stableNodeList[linkFns[i++]]; |
| 9325 | nodeLinkFn = linkFns[i++]; |
| 9326 | childLinkFn = linkFns[i++]; |
| 9327 | |
| 9328 | if (nodeLinkFn) { |
| 9329 | if (nodeLinkFn.scope) { |
| 9330 | childScope = scope.$new(); |
| 9331 | compile.$$addScopeInfo(jqLite(node), childScope); |
| 9332 | } else { |
| 9333 | childScope = scope; |
| 9334 | } |
| 9335 | |
| 9336 | if (nodeLinkFn.transcludeOnThisElement) { |
| 9337 | childBoundTranscludeFn = createBoundTranscludeFn( |
| 9338 | scope, nodeLinkFn.transclude, parentBoundTranscludeFn); |
| 9339 | |
| 9340 | } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) { |
| 9341 | childBoundTranscludeFn = parentBoundTranscludeFn; |
| 9342 | |
| 9343 | } else if (!parentBoundTranscludeFn && transcludeFn) { |
| 9344 | childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn); |
| 9345 | |
| 9346 | } else { |
| 9347 | childBoundTranscludeFn = null; |
| 9348 | } |
| 9349 | |
| 9350 | nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn); |
| 9351 | |
| 9352 | } else if (childLinkFn) { |
| 9353 | childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn); |
| 9354 | } |
| 9355 | } |
| 9356 | } |
| 9357 | } |
| 9358 | |
| 9359 | function mergeConsecutiveTextNodes(nodeList, idx, notLiveList) { |
no test coverage detected