MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / compositeLinkFn

Function compositeLinkFn

code/songhop/www/lib/angular/angular.js:7014–7068  ·  view source on GitHub ↗
(scope, nodeList, $rootElement, parentBoundTranscludeFn)

Source from the content-addressed store, hash-verified

7012 return linkFnFound ? compositeLinkFn : null;
7013
7014 function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {
7015 var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn;
7016 var stableNodeList;
7017
7018
7019 if (nodeLinkFnFound) {
7020 // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our
7021 // offsets don't get screwed up
7022 var nodeListLength = nodeList.length;
7023 stableNodeList = new Array(nodeListLength);
7024
7025 // create a sparse array by only copying the elements which have a linkFn
7026 for (i = 0; i < linkFns.length; i+=3) {
7027 idx = linkFns[i];
7028 stableNodeList[idx] = nodeList[idx];
7029 }
7030 } else {
7031 stableNodeList = nodeList;
7032 }
7033
7034 for (i = 0, ii = linkFns.length; i < ii;) {
7035 node = stableNodeList[linkFns[i++]];
7036 nodeLinkFn = linkFns[i++];
7037 childLinkFn = linkFns[i++];
7038
7039 if (nodeLinkFn) {
7040 if (nodeLinkFn.scope) {
7041 childScope = scope.$new();
7042 compile.$$addScopeInfo(jqLite(node), childScope);
7043 } else {
7044 childScope = scope;
7045 }
7046
7047 if (nodeLinkFn.transcludeOnThisElement) {
7048 childBoundTranscludeFn = createBoundTranscludeFn(
7049 scope, nodeLinkFn.transclude, parentBoundTranscludeFn,
7050 nodeLinkFn.elementTranscludeOnThisElement);
7051
7052 } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {
7053 childBoundTranscludeFn = parentBoundTranscludeFn;
7054
7055 } else if (!parentBoundTranscludeFn && transcludeFn) {
7056 childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);
7057
7058 } else {
7059 childBoundTranscludeFn = null;
7060 }
7061
7062 nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn);
7063
7064 } else if (childLinkFn) {
7065 childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);
7066 }
7067 }
7068 }
7069 }
7070
7071 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