From 0a6cf70debc6440685af3f9ea96a66450e4f4ed7 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 7 Jan 2011 22:02:23 -0800 Subject: 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 --- src/widgets.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/widgets.js') diff --git a/src/widgets.js b/src/widgets.js index 5ff4a28f..5f159990 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -359,15 +359,15 @@ function optionsAccessor(scope, element) { return { get: function(){ var values = []; - foreach(options, function(option){ + forEach(options, function(option){ if (option.selected) values.push(option.value); }); return values; }, set: function(values){ var keys = {}; - foreach(values, function(value){ keys[value] = true; }); - foreach(options, function(option){ + forEach(values, function(value){ keys[value] = true; }); + forEach(options, function(option){ option.selected = keys[option.value]; }); } @@ -698,7 +698,7 @@ var ngSwitch = angularWidget('ng:switch', function (element){ if (isString(when)) { switchCase.when = function(scope, value){ var args = [value, when]; - foreach(usingExprParams, function(arg){ + forEach(usingExprParams, function(arg){ args.push(arg); }); return usingFn.apply(scope, args); @@ -711,7 +711,7 @@ var ngSwitch = angularWidget('ng:switch', function (element){ }); // this needs to be here for IE - foreach(cases, function(_case){ + forEach(cases, function(_case){ _case.element.remove(); }); @@ -722,7 +722,7 @@ var ngSwitch = angularWidget('ng:switch', function (element){ var found = false; element.html(''); childScope = createScope(scope); - foreach(cases, function(switchCase){ + forEach(cases, function(switchCase){ if (!found && switchCase.when(childScope, value)) { found = true; var caseElement = quickClone(switchCase.element); -- cgit v1.2.3