X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fattributes.js;h=a2108feb85c71320b0b9c7ee98a89478302c9845;hb=a00e63ea5a2c26f8e6384b5d1e2247be44c727e9;hp=b3a49f50f869b8ec87f8bda334c397c291079106;hpb=7b0b348419c85841671459b4d7153afc88d1fa83;p=jquery.git diff --git a/src/attributes.js b/src/attributes.js index b3a49f5..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 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; + } } }