git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
52c6739
)
Added support for "first option is auto-selected in a drop-down" functionality.
author
John Resig
<jeresig@gmail.com>
Sun, 8 Jul 2007 16:28:45 +0000
(16:28 +0000)
committer
John Resig
<jeresig@gmail.com>
Sun, 8 Jul 2007 16:28:45 +0000
(16:28 +0000)
build/runtest/env.js
patch
|
blob
|
history
diff --git
a/build/runtest/env.js
b/build/runtest/env.js
index
f4c54bb
..
23b4136
100644
(file)
--- a/
build/runtest/env.js
+++ b/
build/runtest/env.js
@@
-305,6
+305,27
@@
var window = this;
set checked(val) { return this.setAttribute("checked",val); },
get selected() {
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;
},
var val = this.getAttribute("selected");
return val != "false" && !!val;
},