chore: move getBlockElements to Angular.js

This commit is contained in:
Brian Ford 2013-10-30 14:51:52 -07:00
parent e19067c9bb
commit 6578bd0c82
4 changed files with 25 additions and 36 deletions

View file

@ -99,6 +99,7 @@
"assertArgFn": false,
"assertNotHasOwnProperty": false,
"getter": false,
"getBlockElements": false,
/* AngularPublic.js */
"version": false,

View file

@ -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);
}

View file

@ -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);
}
}];

View file

@ -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);
}
}];