style($compile): fix indentation

This commit is contained in:
Igor Minar 2013-01-09 16:54:29 -08:00
parent cc821502bc
commit c909f49112

View file

@ -367,68 +367,68 @@ function $CompileProvider($provide) {
* @returns {?function} A composite linking function of all of the matched directives or null. * @returns {?function} A composite linking function of all of the matched directives or null.
*/ */
function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority) { function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority) {
var linkFns = [], var linkFns = [],
nodeLinkFn, childLinkFn, directives, attrs, linkFnFound; nodeLinkFn, childLinkFn, directives, attrs, linkFnFound;
for(var i = 0; i < nodeList.length; i++) { for(var i = 0; i < nodeList.length; i++) {
attrs = new Attributes(); attrs = new Attributes();
// we must always refer to nodeList[i] since the nodes can be replaced underneath us. // we must always refer to nodeList[i] since the nodes can be replaced underneath us.
directives = collectDirectives(nodeList[i], [], attrs, maxPriority); directives = collectDirectives(nodeList[i], [], attrs, maxPriority);
nodeLinkFn = (directives.length) nodeLinkFn = (directives.length)
? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement) ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement)
: null; : null;
childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || !nodeList[i].childNodes.length) childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || !nodeList[i].childNodes.length)
? null ? null
: compileNodes(nodeList[i].childNodes, : compileNodes(nodeList[i].childNodes,
nodeLinkFn ? nodeLinkFn.transclude : transcludeFn); nodeLinkFn ? nodeLinkFn.transclude : transcludeFn);
linkFns.push(nodeLinkFn); linkFns.push(nodeLinkFn);
linkFns.push(childLinkFn); linkFns.push(childLinkFn);
linkFnFound = (linkFnFound || nodeLinkFn || childLinkFn); linkFnFound = (linkFnFound || nodeLinkFn || childLinkFn);
} }
// return a linking function if we have found anything, null otherwise // return a linking function if we have found anything, null otherwise
return linkFnFound ? compositeLinkFn : null; return linkFnFound ? compositeLinkFn : null;
function compositeLinkFn(scope, nodeList, $rootElement, boundTranscludeFn) { function compositeLinkFn(scope, nodeList, $rootElement, boundTranscludeFn) {
var nodeLinkFn, childLinkFn, node, childScope, childTranscludeFn; var nodeLinkFn, childLinkFn, node, childScope, childTranscludeFn;
for(var i = 0, n = 0, ii = linkFns.length; i < ii; n++) { for(var i = 0, n = 0, ii = linkFns.length; i < ii; n++) {
node = nodeList[n]; node = nodeList[n];
nodeLinkFn = linkFns[i++]; nodeLinkFn = linkFns[i++];
childLinkFn = linkFns[i++]; childLinkFn = linkFns[i++];
if (nodeLinkFn) { if (nodeLinkFn) {
if (nodeLinkFn.scope) { if (nodeLinkFn.scope) {
childScope = scope.$new(isObject(nodeLinkFn.scope)); childScope = scope.$new(isObject(nodeLinkFn.scope));
jqLite(node).data('$scope', childScope); jqLite(node).data('$scope', childScope);
} else { } else {
childScope = scope; childScope = scope;
} }
childTranscludeFn = nodeLinkFn.transclude; childTranscludeFn = nodeLinkFn.transclude;
if (childTranscludeFn || (!boundTranscludeFn && transcludeFn)) { if (childTranscludeFn || (!boundTranscludeFn && transcludeFn)) {
nodeLinkFn(childLinkFn, childScope, node, $rootElement, nodeLinkFn(childLinkFn, childScope, node, $rootElement,
(function(transcludeFn) { (function(transcludeFn) {
return function(cloneFn) { return function(cloneFn) {
var transcludeScope = scope.$new(); var transcludeScope = scope.$new();
return transcludeFn(transcludeScope, cloneFn). return transcludeFn(transcludeScope, cloneFn).
bind('$destroy', bind(transcludeScope, transcludeScope.$destroy)); bind('$destroy', bind(transcludeScope, transcludeScope.$destroy));
}; };
})(childTranscludeFn || transcludeFn) })(childTranscludeFn || transcludeFn)
); );
} else { } else {
nodeLinkFn(childLinkFn, childScope, node, undefined, boundTranscludeFn); nodeLinkFn(childLinkFn, childScope, node, undefined, boundTranscludeFn);
} }
} else if (childLinkFn) { } else if (childLinkFn) {
childLinkFn(scope, node.childNodes, undefined, boundTranscludeFn); childLinkFn(scope, node.childNodes, undefined, boundTranscludeFn);
} }
} }
} }
} }
/** /**