From f75c0627f22b4af52199b46659675258811970f5 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Mon, 31 Dec 2012 14:32:58 -0500 Subject: [PATCH] Restore optSelected hack still needed by IE9/10 --- src/attributes.js | 14 ++++++++++++++ src/support.js | 4 ++++ 2 files changed, 18 insertions(+) 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>", -- 2.39.5