]> source.dussan.org Git - jquery.git/commitdiff
Restore optSelected hack still needed by IE9/10
authorDave Methvin <dave.methvin@gmail.com>
Mon, 31 Dec 2012 19:32:58 +0000 (14:32 -0500)
committerDave Methvin <dave.methvin@gmail.com>
Mon, 31 Dec 2012 19:32:58 +0000 (14:32 -0500)
src/attributes.js
src/support.js

index a9a016eb86733f9751a96d7a0aa5e1a10257e88a..ed6490080506278e8495a4fe001ec8aa3fc5c380 100644 (file)
@@ -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;
+               }
+       });
+}
index 5e3a7f4ba760263e86ee3a716cc28b282f6bf388..9533294ffa054be455532f7d253bea6bee27151e 100644 (file)
@@ -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></:nav>",