X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;ds=sidebyside;f=src%2Fattributes.js;h=a2108feb85c71320b0b9c7ee98a89478302c9845;hb=ea5d51400820585a6d31011e1a1109c5a1213360;hp=30b3205a1fd3f5491c46b43fdab56fe610d3ee0e;hpb=4729f4d44326fd302c63af8f3324b6c4bac54084;p=jquery.git diff --git a/src/attributes.js b/src/attributes.js index 30b3205..a2108fe 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 a hidden option + // 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; + } } }