Permalink
Browse files

Select/Option fixes to make YUI DOM tests pass

  • Loading branch information...
1 parent 0eb85d7 commit 37bf5fea907cb0a1d6ad407d84fddf6beb242b2c @davglass davglass committed Nov 6, 2010
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/jsdom/level2/html.js
View
@@ -420,6 +420,9 @@ define('HTMLSelectElement', {
get value() {
var i = this.selectedIndex;
+ if (this.options.length && (i === -1)) {
+ i = 0;
+ }
if (i === -1) {
return '';
}
@@ -500,10 +503,10 @@ define('HTMLOptionElement', {
return this._initDefaultSelected();
},
get text() {
- return this.innerHTML;
+ return (this.hasAttribute('value')) ? this.getAttribute('value') : this.innerHTML;
},
get value() {
- return this.getAttribute('value') || this.innerHTML;
+ return (this.hasAttribute('value')) ? this.getAttribute('value') : this.innerHTML;
},
set value(val) {
this.setAttribute('value', val);

0 comments on commit 37bf5fe

Please sign in to comment.