From: Dave Methvin Date: Mon, 31 Dec 2012 19:32:58 +0000 (-0500) Subject: Restore optSelected hack still needed by IE9/10 X-Git-Tag: 2.0.0b1~55 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f75c0627f22b4af52199b46659675258811970f5;p=jquery.git Restore optSelected hack still needed by IE9/10 --- diff --git a/src/attributes.js b/src/attributes.js index a9a016eb8..ed6490080 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -478,3 +478,17 @@ jQuery.each([ "radio", "checkbox" ], function() { } }); }); + +// IE9/10 do not see a selected option inside an optgroup unless you access it +// Support: IE9, IE10 +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + if ( parent && parent.parentNode ) { + parent.parentNode.selectedIndex; + } + return null; + } + }); +} diff --git a/src/support.js b/src/support.js index 5e3a7f4ba..9533294ff 100644 --- a/src/support.js +++ b/src/support.js @@ -47,6 +47,10 @@ jQuery.support = (function() { // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) checkOn: !!input.value, + // Must access the parent to make an option select properly + // Support: IE9, IE10 + optSelected: opt.selected, + // Makes sure cloning an html5 element does not cause problems // Where outerHTML is undefined, this still works html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>",