MCPcopy Create free account
hub / github.com/cafebazaar/blacksmith / compositeLinkFn

Function compositeLinkFn

web/static/bower_components/angular/angular.js:7628–7687  ·  view source on GitHub ↗
(scope, nodeList, $rootElement, parentBoundTranscludeFn)

Source from the content-addressed store, hash-verified

7626 return linkFnFound ? compositeLinkFn : null;
7627
7628 function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {
7629 var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn;
7630 var stableNodeList;
7631
7632
7633 if (nodeLinkFnFound) {
7634 // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our
7635 // offsets don't get screwed up
7636 var nodeListLength = nodeList.length;
7637 stableNodeList = new Array(nodeListLength);
7638
7639 // create a sparse array by only copying the elements which have a linkFn
7640 for (i = 0; i < linkFns.length; i+=3) {
7641 idx = linkFns[i];
7642 stableNodeList[idx] = nodeList[idx];
7643 }
7644 } else {
7645 stableNodeList = nodeList;
7646 }
7647
7648 for (i = 0, ii = linkFns.length; i < ii;) {
7649 node = stableNodeList[linkFns[i++]];
7650 nodeLinkFn = linkFns[i++];
7651 childLinkFn = linkFns[i++];
7652
7653 if (nodeLinkFn) {
7654 if (nodeLinkFn.scope) {
7655 childScope = scope.$new();
7656 compile.$$addScopeInfo(jqLite(node), childScope);
7657 var destroyBindings = nodeLinkFn.$$destroyBindings;
7658 if (destroyBindings) {
7659 nodeLinkFn.$$destroyBindings = null;
7660 childScope.$on('$destroyed', destroyBindings);
7661 }
7662 } else {
7663 childScope = scope;
7664 }
7665
7666 if (nodeLinkFn.transcludeOnThisElement) {
7667 childBoundTranscludeFn = createBoundTranscludeFn(
7668 scope, nodeLinkFn.transclude, parentBoundTranscludeFn);
7669
7670 } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {
7671 childBoundTranscludeFn = parentBoundTranscludeFn;
7672
7673 } else if (!parentBoundTranscludeFn && transcludeFn) {
7674 childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);
7675
7676 } else {
7677 childBoundTranscludeFn = null;
7678 }
7679
7680 nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn,
7681 nodeLinkFn);
7682
7683 } else if (childLinkFn) {
7684 childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);
7685 }

Callers 1

compileFunction · 0.85

Calls 2

createBoundTranscludeFnFunction · 0.85
nodeLinkFnFunction · 0.85

Tested by

no test coverage detected