Rename variable in Form.Element.Serializers.select. [#180 state:resolved]
This commit is contained in:
parent
6c6f8d39ea
commit
7444a4ad02
|
@ -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)
|
||||
|
||||
|
|
12
src/form.js
12
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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue