aboutsummaryrefslogtreecommitdiffstats
path: root/src/attributes.js
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2009-12-22 15:46:54 -0500
committerjeresig <jeresig@gmail.com>2009-12-22 15:46:54 -0500
commita00e63ea5a2c26f8e6384b5d1e2247be44c727e9 (patch)
treeae753969bb7fbda549068216062205f07c11e1d9 /src/attributes.js
parent7b0b348419c85841671459b4d7153afc88d1fa83 (diff)
downloadjquery-a00e63ea5a2c26f8e6384b5d1e2247be44c727e9.tar.gz
jquery-a00e63ea5a2c26f8e6384b5d1e2247be44c727e9.zip
Make a feature detect for the attribute selected code. Fixes #5702.
Diffstat (limited to 'src/attributes.js')
-rw-r--r--src/attributes.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/attributes.js b/src/attributes.js
index b3a49f50f..a2108feb8 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -261,16 +261,19 @@ jQuery.extend({
// Only do all the following if this is a node (faster for style)
if ( elem.nodeType === 1 ) {
// These attributes require special treatment
- var special = rspecialurl.test( name ), parent = elem.parentNode;
+ var special = rspecialurl.test( name );
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
- if ( name === "selected" && parent ) {
- parent.selectedIndex;
-
- // Make sure that it also works with optgroups, see #5701
- if ( parent.parentNode ) {
- parent.parentNode.selectedIndex;
+ if ( name === "selected" && !jQuery.support.optSelected ) {
+ var parent = elem.parentNode;
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
}
}