Skip to content

Commit f75c062

Browse files
committed
Restore optSelected hack still needed by IE9/10
1 parent 747dd8c commit f75c062

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/attributes.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,3 +478,17 @@ jQuery.each([ "radio", "checkbox" ], function() {
478478
}
479479
});
480480
});
481+
482+
// IE9/10 do not see a selected option inside an optgroup unless you access it
483+
// Support: IE9, IE10
484+
if ( !jQuery.support.optSelected ) {
485+
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
486+
get: function( elem ) {
487+
var parent = elem.parentNode;
488+
if ( parent && parent.parentNode ) {
489+
parent.parentNode.selectedIndex;
490+
}
491+
return null;
492+
}
493+
});
494+
}

src/support.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ jQuery.support = (function() {
4747
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
4848
checkOn: !!input.value,
4949

50+
// Must access the parent to make an option select properly
51+
// Support: IE9, IE10
52+
optSelected: opt.selected,
53+
5054
// Makes sure cloning an html5 element does not cause problems
5155
// Where outerHTML is undefined, this still works
5256
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",

0 commit comments

Comments
 (0)