MCPcopy Index your code
hub / github.com/angular-ui/ui-router / compositeLinkFn

Function compositeLinkFn

test/angular/1.3/angular.js:7092–7146  ·  view source on GitHub ↗
(scope, nodeList, $rootElement, parentBoundTranscludeFn)

Source from the content-addressed store, hash-verified

7090 return linkFnFound ? compositeLinkFn : null;
7091
7092 function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {
7093 var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn;
7094 var stableNodeList;
7095
7096
7097 if (nodeLinkFnFound) {
7098 // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our
7099 // offsets don't get screwed up
7100 var nodeListLength = nodeList.length;
7101 stableNodeList = new Array(nodeListLength);
7102
7103 // create a sparse array by only copying the elements which have a linkFn
7104 for (i = 0; i < linkFns.length; i+=3) {
7105 idx = linkFns[i];
7106 stableNodeList[idx] = nodeList[idx];
7107 }
7108 } else {
7109 stableNodeList = nodeList;
7110 }
7111
7112 for (i = 0, ii = linkFns.length; i < ii;) {
7113 node = stableNodeList[linkFns[i++]];
7114 nodeLinkFn = linkFns[i++];
7115 childLinkFn = linkFns[i++];
7116
7117 if (nodeLinkFn) {
7118 if (nodeLinkFn.scope) {
7119 childScope = scope.$new();
7120 compile.$$addScopeInfo(jqLite(node), childScope);
7121 } else {
7122 childScope = scope;
7123 }
7124
7125 if (nodeLinkFn.transcludeOnThisElement) {
7126 childBoundTranscludeFn = createBoundTranscludeFn(
7127 scope, nodeLinkFn.transclude, parentBoundTranscludeFn,
7128 nodeLinkFn.elementTranscludeOnThisElement);
7129
7130 } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {
7131 childBoundTranscludeFn = parentBoundTranscludeFn;
7132
7133 } else if (!parentBoundTranscludeFn && transcludeFn) {
7134 childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);
7135
7136 } else {
7137 childBoundTranscludeFn = null;
7138 }
7139
7140 nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn);
7141
7142 } else if (childLinkFn) {
7143 childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);
7144 }
7145 }
7146 }
7147 }
7148
7149 function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn, elementTransclusion) {

Callers 1

compileFunction · 0.70

Calls 2

createBoundTranscludeFnFunction · 0.70
nodeLinkFnFunction · 0.70

Tested by

no test coverage detected