X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=build%2Fruntest%2Fenv.js;h=6483324627ba37c4282bd4b2d6eb35ee3df4e1d2;hb=feb475d9b1f7fc0a1b6efa746e952893014ff771;hp=f4c54bb4bdf6dc7e1680d14e4347fe2962f547a5;hpb=52c6739c20838f2d705d404664dcc0cfa07f2c30;p=jquery.git diff --git a/build/runtest/env.js b/build/runtest/env.js index f4c54bb..6483324 100644 --- a/build/runtest/env.js +++ b/build/runtest/env.js @@ -106,7 +106,7 @@ var window = this; return makeNode( this._dom.getDocumentElement() ); }, get ownerDocument(){ - return this; + return null; }, addEventListener: function(){}, removeEventListener: function(){}, @@ -206,8 +206,7 @@ var window = this; this.style = {}; // Load CSS info - var styles = (new String(this.getAttribute("style") || "")) - .split(/\s*;\s*/); + var styles = (this.getAttribute("style") || "").split(/\s*;\s*/); for ( var i = 0; i < styles.length; i++ ) { var style = styles[i].split(/\s*:\s*/); @@ -305,6 +304,27 @@ var window = this; set checked(val) { return this.setAttribute("checked",val); }, get selected() { + if ( !this._selectDone ) { + this._selectDone = true; + + if ( this.nodeName == "OPTION" && !this.parentNode.getAttribute("multiple") ) { + var opt = this.parentNode.getElementsByTagName("option"); + + if ( this == opt[0] ) { + var select = true; + + for ( var i = 1; i < opt.length; i++ ) + if ( opt[i].selected ) { + select = false; + break; + } + + if ( select ) + this.selected = true; + } + } + } + var val = this.getAttribute("selected"); return val != "false" && !!val; }, @@ -327,7 +347,7 @@ var window = this; getAttribute: function(name){ return this._dom.hasAttribute(name) ? - this._dom.getAttribute(name) : + new String( this._dom.getAttribute(name) ) : null; }, setAttribute: function(name,value){