MCPcopy Create free account
hub / github.com/angular-ui/ui-grid / compositeLinkFn

Function compositeLinkFn

lib/test/angular/1.4.3/angular.js:7489–7548  ·  view source on GitHub ↗
(scope, nodeList, $rootElement, parentBoundTranscludeFn)

Source from the content-addressed store, hash-verified

7487 return linkFnFound ? compositeLinkFn : null;
7488
7489 function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {
7490 var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn;
7491 var stableNodeList;
7492
7493
7494 if (nodeLinkFnFound) {
7495 // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our
7496 // offsets don't get screwed up
7497 var nodeListLength = nodeList.length;
7498 stableNodeList = new Array(nodeListLength);
7499
7500 // create a sparse array by only copying the elements which have a linkFn
7501 for (i = 0; i < linkFns.length; i+=3) {
7502 idx = linkFns[i];
7503 stableNodeList[idx] = nodeList[idx];
7504 }
7505 } else {
7506 stableNodeList = nodeList;
7507 }
7508
7509 for (i = 0, ii = linkFns.length; i < ii;) {
7510 node = stableNodeList[linkFns[i++]];
7511 nodeLinkFn = linkFns[i++];
7512 childLinkFn = linkFns[i++];
7513
7514 if (nodeLinkFn) {
7515 if (nodeLinkFn.scope) {
7516 childScope = scope.$new();
7517 compile.$$addScopeInfo(jqLite(node), childScope);
7518 var destroyBindings = nodeLinkFn.$$destroyBindings;
7519 if (destroyBindings) {
7520 nodeLinkFn.$$destroyBindings = null;
7521 childScope.$on('$destroyed', destroyBindings);
7522 }
7523 } else {
7524 childScope = scope;
7525 }
7526
7527 if (nodeLinkFn.transcludeOnThisElement) {
7528 childBoundTranscludeFn = createBoundTranscludeFn(
7529 scope, nodeLinkFn.transclude, parentBoundTranscludeFn);
7530
7531 } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {
7532 childBoundTranscludeFn = parentBoundTranscludeFn;
7533
7534 } else if (!parentBoundTranscludeFn && transcludeFn) {
7535 childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);
7536
7537 } else {
7538 childBoundTranscludeFn = null;
7539 }
7540
7541 nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn,
7542 nodeLinkFn);
7543
7544 } else if (childLinkFn) {
7545 childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);
7546 }

Callers 1

compileFunction · 0.70

Calls 2

createBoundTranscludeFnFunction · 0.70
nodeLinkFnFunction · 0.70

Tested by

no test coverage detected