Navigation Menu

Skip to content

Commit

Permalink
fix some serious bugs in HTMLOptioElement.index, plus other style jsl…
Browse files Browse the repository at this point in the history
…int nits
  • Loading branch information
client9 committed Mar 30, 2010
1 parent 249158e commit bfdd96d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/html/option.js
Expand Up @@ -49,14 +49,15 @@ __extend__(HTMLOptionElement.prototype, {
},
get index() {
var options = this.parentNode.childNodes,
index = 0,
i;
index = 0,
i, opt;

for (i=0; i < options.length; i++) {
if (options.nodeType === Node.ELEMENT_NODE && node.tagName === "OPTION") {
opt = options[i];
if (opt.nodeType === Node.ELEMENT_NODE && opt.tagName === "OPTION") {
index++;
}
if (this == options[i]) {
if (this == opt) {
return index;
}
}
Expand All @@ -79,7 +80,7 @@ __extend__(HTMLOptionElement.prototype, {
get selected() {
// if disabled, return false

return (this.getAttribute('selected')=='selected');
return (this.getAttribute('selected') === 'selected');
},
set selected(value) {
// if disabled, ignore? or error?
Expand Down

0 comments on commit bfdd96d

Please sign in to comment.