diff --git a/CHANGELOG b/CHANGELOG index c4a8583..2b0dbcc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/src/form.js b/src/form.js index 5f51771..68c4400 100644 --- a/src/form.js +++ b/src/form.js @@ -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); } } },