Skip to content

Commit

Permalink
Rename variable in Form.Element.Serializers.select. [prototypejs#180
Browse files Browse the repository at this point in the history
…state:resolved]
  • Loading branch information
savetheclocktower authored and tobie committed Sep 8, 2008
1 parent 6c6f8d3 commit 7444a4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion 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)

Expand Down
12 changes: 6 additions & 6 deletions src/form.js
Expand Up @@ -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);
}
}
},
Expand Down

0 comments on commit 7444a4a

Please sign in to comment.