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:
a384d84
)
Add a feature test for options inside a disabled select. Follow-up to 157a383dae5335e...
author
jeresig
<jeresig@gmail.com>
Mon, 27 Sep 2010 14:19:55 +0000
(10:19 -0400)
committer
jeresig
<jeresig@gmail.com>
Mon, 27 Sep 2010 14:19:55 +0000
(10:19 -0400)
src/attributes.js
patch
|
blob
|
history
src/support.js
patch
|
blob
|
history
diff --git
a/src/attributes.js
b/src/attributes.js
index
1afcf2a
..
dd6a3e7
100644
(file)
--- a/
src/attributes.js
+++ b/
src/attributes.js
@@
-164,8
+164,9
@@
jQuery.fn.extend({
var option = options[ i ];
// Don't return options that are disabled or in a disabled optgroup
var option = options[ i ];
// Don't return options that are disabled or in a disabled optgroup
- if ( option.selected && option.getAttribute("disabled") === null &&
+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
+
// Get the specific value for the option
value = jQuery(option).val();
// Get the specific value for the option
value = jQuery(option).val();
diff --git
a/src/support.js
b/src/support.js
index
75e89dd
..
2015918
100644
(file)
--- a/
src/support.js
+++ b/
src/support.js
@@
-20,6
+20,9
@@
return;
}
return;
}
+ var select = document.createElement("select");
+ var opt = select.appendChild( document.createElement("option") );
+
jQuery.support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: div.firstChild.nodeType === 3,
jQuery.support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: div.firstChild.nodeType === 3,
@@
-56,15
+59,21
@@
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
- optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
+ optSelected: opt.selected,
// Will be defined later
// Will be defined later
+ optDisabled: false,
checkClone: false,
scriptEval: false,
noCloneEvent: true,
boxModel: null
};
checkClone: false,
scriptEval: false,
noCloneEvent: true,
boxModel: null
};
+ // Make sure that the options inside disabled selects aren't marked as disabled
+ // (WebKit marks them as diabled)
+ select.disabled = true;
+ jQuery.support.optDisabled = !opt.disabled;
+
script.type = "text/javascript";
try {
script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
script.type = "text/javascript";
try {
script.appendChild( document.createTextNode( "window." + id + "=1;" ) );