From 7444a4ad026623d3e60fc24d1fbdc343ee6a9fd5 Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Thu, 26 Jun 2008 14:50:50 -0500 Subject: [PATCH] Rename variable in Form.Element.Serializers.select. [#180 state:resolved] --- CHANGELOG | 4 +++- src/form.js | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) 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); } } },