diff options
author | jeresig <jeresig@gmail.com> | 2009-12-22 15:46:54 -0500 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2009-12-22 15:46:54 -0500 |
commit | a00e63ea5a2c26f8e6384b5d1e2247be44c727e9 (patch) | |
tree | ae753969bb7fbda549068216062205f07c11e1d9 /src/attributes.js | |
parent | 7b0b348419c85841671459b4d7153afc88d1fa83 (diff) | |
download | jquery-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.js | 17 |
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; + } } } |