aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.jshintrc1
-rw-r--r--src/Angular.js25
-rw-r--r--src/ng/directive/ngIf.js18
-rw-r--r--src/ng/directive/ngRepeat.js17
4 files changed, 25 insertions, 36 deletions
diff --git a/src/.jshintrc b/src/.jshintrc
index 754c27dc..e29b09f3 100644
--- a/src/.jshintrc
+++ b/src/.jshintrc
@@ -99,6 +99,7 @@
"assertArgFn": false,
"assertNotHasOwnProperty": false,
"getter": false,
+ "getBlockElements": false,
/* AngularPublic.js */
"version": false,
diff --git a/src/Angular.js b/src/Angular.js
index 0cdeab3f..df236e05 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -79,7 +79,8 @@
-assertArg,
-assertArgFn,
-assertNotHasOwnProperty,
- -getter
+ -getter,
+ -getBlockElements
*/
@@ -1318,3 +1319,25 @@ function getter(obj, path, bindFnToScope) {
}
return obj;
}
+
+/**
+ * Return the siblings between `startNode` and `endNode`, inclusive
+ * @param {Object} object with `startNode` and `endNode` properties
+ * @returns jQlite object containing the elements
+ */
+function getBlockElements(block) {
+ if (block.startNode === block.endNode) {
+ return jqLite(block.startNode);
+ }
+
+ var element = block.startNode;
+ var elements = [element];
+
+ do {
+ element = element.nextSibling;
+ if (!element) break;
+ elements.push(element);
+ } while (element !== block.endNode);
+
+ return jqLite(elements);
+}
diff --git a/src/ng/directive/ngIf.js b/src/ng/directive/ngIf.js
index 662f3f32..3f56449f 100644
--- a/src/ng/directive/ngIf.js
+++ b/src/ng/directive/ngIf.js
@@ -108,22 +108,4 @@ var ngIfDirective = ['$animate', function($animate) {
};
}
};
-
- // TODO(bford): this helper was copypasta'd from ngRepeat
- function getBlockElements(block) {
- if (block.startNode === block.endNode) {
- return jqLite(block.startNode);
- }
-
- var element = block.startNode;
- var elements = [element];
-
- do {
- element = element.nextSibling;
- if (!element) break;
- elements.push(element);
- } while (element !== block.endNode);
-
- return jqLite(elements);
- }
}];
diff --git a/src/ng/directive/ngRepeat.js b/src/ng/directive/ngRepeat.js
index e3ff1b8e..ee0faf23 100644
--- a/src/ng/directive/ngRepeat.js
+++ b/src/ng/directive/ngRepeat.js
@@ -393,22 +393,5 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
};
}
};
-
- function getBlockElements(block) {
- if (block.startNode === block.endNode) {
- return jqLite(block.startNode);
- }
-
- var element = block.startNode;
- var elements = [element];
-
- do {
- element = element.nextSibling;
- if (!element) break;
- elements.push(element);
- } while (element !== block.endNode);
-
- return jqLite(elements);
- }
}];