Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 524c5c8

Browse files
committed
style($compile): better fn names for debugging
1 parent b936236 commit 524c5c8

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

src/ng/compile.js

+24-23
Original file line numberDiff line numberDiff line change
@@ -310,26 +310,26 @@ function $CompileProvider($provide) {
310310

311311
//================================
312312

313-
function compile($compileNode, transcludeFn, maxPriority) {
314-
if (!($compileNode instanceof jqLite)) {
313+
function compile($compileNodes, transcludeFn, maxPriority) {
314+
if (!($compileNodes instanceof jqLite)) {
315315
// jquery always rewraps, where as we need to preserve the original selector so that we can modify it.
316-
$compileNode = jqLite($compileNode);
316+
$compileNodes = jqLite($compileNodes);
317317
}
318318
// We can not compile top level text elements since text nodes can be merged and we will
319319
// not be able to attach scope data to them, so we will wrap them in <span>
320-
forEach($compileNode, function(node, index){
320+
forEach($compileNodes, function(node, index){
321321
if (node.nodeType == 3 /* text node */) {
322-
$compileNode[index] = jqLite(node).wrap('<span></span>').parent()[0];
322+
$compileNodes[index] = jqLite(node).wrap('<span></span>').parent()[0];
323323
}
324324
});
325-
var compositeLinkFn = compileNodes($compileNode, transcludeFn, $compileNode, maxPriority);
326-
return function(scope, cloneConnectFn){
325+
var compositeLinkFn = compileNodes($compileNodes, transcludeFn, $compileNodes, maxPriority);
326+
return function publicLinkFn(scope, cloneConnectFn){
327327
assertArg(scope, 'scope');
328328
// important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart
329329
// and sometimes changes the structure of the DOM.
330330
var $linkNode = cloneConnectFn
331-
? JQLitePrototype.clone.call($compileNode) // IMPORTANT!!!
332-
: $compileNode;
331+
? JQLitePrototype.clone.call($compileNodes) // IMPORTANT!!!
332+
: $compileNodes;
333333
$linkNode.data('$scope', scope);
334334
safeAddClass($linkNode, 'ng-scope');
335335
if (cloneConnectFn) cloneConnectFn($linkNode, scope);
@@ -432,13 +432,14 @@ function $CompileProvider($provide) {
432432

433433

434434
/**
435-
* Looks for directives on the given node ands them to the directive collection which is sorted.
435+
* Looks for directives on the given node and adds them to the directive collection which is
436+
* sorted.
436437
*
437-
* @param node node to search
438-
* @param directives an array to which the directives are added to. This array is sorted before
438+
* @param node Node to search.
439+
* @param directives An array to which the directives are added to. This array is sorted before
439440
* the function returns.
440-
* @param attrs the shared attrs object which is used to populate the normalized attributes.
441-
* @param {number=} max directive priority
441+
* @param attrs The shared attrs object which is used to populate the normalized attributes.
442+
* @param {number=} maxPriority Max directive priority.
442443
*/
443444
function collectDirectives(node, directives, attrs, maxPriority) {
444445
var nodeType = node.nodeType,
@@ -527,7 +528,7 @@ function $CompileProvider($provide) {
527528
preLinkFns = [],
528529
postLinkFns = [],
529530
newScopeDirective = null,
530-
newIsolatedScopeDirective = null,
531+
newIsolateScopeDirective = null,
531532
templateDirective = null,
532533
$compileNode = templateAttrs.$$element = jqLite(compileNode),
533534
directive,
@@ -549,10 +550,10 @@ function $CompileProvider($provide) {
549550
}
550551

551552
if (directiveValue = directive.scope) {
552-
assertNoDuplicate('isolated scope', newIsolatedScopeDirective, directive, $compileNode);
553+
assertNoDuplicate('isolated scope', newIsolateScopeDirective, directive, $compileNode);
553554
if (isObject(directiveValue)) {
554555
safeAddClass($compileNode, 'ng-isolate-scope');
555-
newIsolatedScopeDirective = directive;
556+
newIsolateScopeDirective = directive;
556557
}
557558
safeAddClass($compileNode, 'ng-scope');
558559
newScopeDirective = newScopeDirective || directive;
@@ -706,12 +707,12 @@ function $CompileProvider($provide) {
706707
}
707708
$element = attrs.$$element;
708709

709-
if (newIsolatedScopeDirective) {
710+
if (newIsolateScopeDirective) {
710711
var LOCAL_REGEXP = /^\s*([@=&])\s*(\w*)\s*$/;
711712

712713
var parentScope = scope.$parent || scope;
713714

714-
forEach(newIsolatedScopeDirective.scope, function(definiton, scopeName) {
715+
forEach(newIsolateScopeDirective.scope, function(definiton, scopeName) {
715716
var match = definiton.match(LOCAL_REGEXP) || [],
716717
attrName = match[2]|| scopeName,
717718
mode = match[1], // @, =, or &
@@ -734,7 +735,7 @@ function $CompileProvider($provide) {
734735
// reset the change, or we will throw this exception on every $digest
735736
lastValue = scope[scopeName] = parentGet(parentScope);
736737
throw Error(NON_ASSIGNABLE_MODEL_EXPRESSION + attrs[attrName] +
737-
' (directive: ' + newIsolatedScopeDirective.name + ')');
738+
' (directive: ' + newIsolateScopeDirective.name + ')');
738739
};
739740
lastValue = scope[scopeName] = parentGet(parentScope);
740741
scope.$watch(function parentValueWatch() {
@@ -765,7 +766,7 @@ function $CompileProvider($provide) {
765766

766767
default: {
767768
throw Error('Invalid isolate scope definition for directive ' +
768-
newIsolatedScopeDirective.name + ': ' + definiton);
769+
newIsolateScopeDirective.name + ': ' + definiton);
769770
}
770771
}
771772
});
@@ -991,7 +992,7 @@ function $CompileProvider($provide) {
991992
if (interpolateFn) {
992993
directives.push({
993994
priority: 0,
994-
compile: valueFn(function(scope, node) {
995+
compile: valueFn(function textInterpolateLinkFn(scope, node) {
995996
var parent = node.parent(),
996997
bindings = parent.data('$binding') || [];
997998
bindings.push(interpolateFn);
@@ -1014,7 +1015,7 @@ function $CompileProvider($provide) {
10141015

10151016
directives.push({
10161017
priority: 100,
1017-
compile: valueFn(function(scope, element, attr) {
1018+
compile: valueFn(function attrInterpolateLinkFn(scope, element, attr) {
10181019
var $$observers = (attr.$$observers || (attr.$$observers = {}));
10191020

10201021
if (name === 'class') {

0 commit comments

Comments
 (0)