aboutsummaryrefslogtreecommitdiffstats
path: root/test/testabilityPatch.js
diff options
context:
space:
mode:
authorIgor Minar2011-01-07 22:02:23 -0800
committerIgor Minar2011-01-10 10:26:55 -0800
commit0a6cf70debc6440685af3f9ea96a66450e4f4ed7 (patch)
tree3b7e82bedf53960deb5d460532779ec449dd8dfc /test/testabilityPatch.js
parentc79aba92f6b058742c9ae20a9382f6abc68afcea (diff)
downloadangular.js-0a6cf70debc6440685af3f9ea96a66450e4f4ed7.tar.bz2
Rename angular.foreach to angular.forEach to make the api consistent.
camelcase is used for other angular functions and forEach is also used by EcmaScript standard. - rename the internal as well as the external function name - tweak the implementation of the function so that it doesn't clober it self when we extend the angular object with an object that has a forEach property equal to this forEach function Closes #85
Diffstat (limited to 'test/testabilityPatch.js')
-rw-r--r--test/testabilityPatch.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js
index 6cbf91e9..224a8915 100644
--- a/test/testabilityPatch.js
+++ b/test/testabilityPatch.js
@@ -56,10 +56,10 @@ afterEach(clearJqCache);
function clearJqCache(){
var count = 0;
- foreachSorted(jqCache, function(value, key){
+ forEachSorted(jqCache, function(value, key){
count ++;
delete jqCache[key];
- foreach(value, function(value, key){
+ forEach(value, function(value, key){
if (value.$element)
dump(key, sortedHtml(value.$element));
else
@@ -91,7 +91,7 @@ extend(angular, {
'copy': copy,
'extend': extend,
'equals': equals,
- 'foreach': foreach,
+ 'forEach': forEach,
'noop':noop,
'bind':bind,
'toJson': toJson,
@@ -103,13 +103,14 @@ extend(angular, {
'isFunction': isFunction,
'isObject': isObject,
'isNumber': isNumber,
- 'isArray': isArray
+ 'isArray': isArray,
+ 'forEach': forEach
});
function sortedHtml(element, showNgClass) {
var html = "";
- foreach(jqLite(element), function toString(node) {
+ forEach(jqLite(element), function toString(node) {
if (node.nodeName == "#text") {
html += node.nodeValue.
replace(/&(\w+[&;\W])?/g, function(match, entity){return entity?match:'&';}).
@@ -155,7 +156,7 @@ function sortedHtml(element, showNgClass) {
if (node.style) {
var style = [];
if (node.style.cssText) {
- foreach(node.style.cssText.split(';'), function(value){
+ forEach(node.style.cssText.split(';'), function(value){
value = trim(value);
if (value) {
style.push(lowercase(value));
@@ -174,7 +175,7 @@ function sortedHtml(element, showNgClass) {
style.sort();
var tmp = style;
style = [];
- foreach(tmp, function(value){
+ forEach(tmp, function(value){
if (!value.match(/^max[^\-]/))
style.push(value);
});