Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rename variable in Form.Element.Serializers.select. [#180 state:resol…
…ved]
  • Loading branch information
savetheclocktower committed Jun 26, 2008
1 parent 0755dbd commit 6f79c78
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
@@ -1,3 +1,5 @@
* Rename variable in Form.Element.Serializers.select. [jddalton]

* Replace browser sniffing with capability detection in IE fork of String#unescapeHTML. [kangax]

* Coerce Opera's version string into a number whenever we need to sniff. [Sam Holman, jddalton]
Expand Down
12 changes: 6 additions & 6 deletions src/form.js
Expand Up @@ -248,22 +248,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 6f79c78

Please sign in to comment.