Rename variable in Form.Element.Serializers.select. [#180 state:resolved]

This commit is contained in:
Andrew Dupont 2008-06-26 14:50:50 -05:00 committed by Tobie Langel
parent 6c6f8d39ea
commit 7444a4ad02
2 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,6 @@
* Coerce Opera's version string into a number whenever we need to sniff. [Sam Holman, jddalton]
* Rename variable in Form.Element.Serializers.select. (jddalton)
* Coerce Opera's version string into a number whenever we need to sniff. (Sam Holman, jddalton)
* Ensure Object.isElement handles "falsy" values properly. (kangax)

View File

@ -212,22 +212,22 @@ Form.Element.Serializers = {
else element.value = value;
},
select: function(element, index) {
if (Object.isUndefined(index))
select: function(element, value) {
if (Object.isUndefined(value))
return this[element.type == 'select-one' ?
'selectOne' : 'selectMany'](element);
else {
var opt, value, single = !Object.isArray(index);
var opt, currentValue, single = !Object.isArray(value);
for (var i = 0, length = element.length; i < length; i++) {
opt = element.options[i];
value = this.optionValue(opt);
currentValue = this.optionValue(opt);
if (single) {
if (value == index) {
if (currentValue == value) {
opt.selected = true;
return;
}
}
else opt.selected = index.include(value);
else opt.selected = value.include(currentValue);
}
}
},