10000 Manipulation: Skip the select wrapper for <option> outside of IE 9 · tamcy/jquery@5f203e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5f203e9

Browse files
mgoltamcy
authored andcommitted
Manipulation: Skip the select wrapper for <option> outside of IE 9
Closes jquerygh-4647 # Conflicts: # src/manipulation/wrapMap.js # test/unit/support.js
1 parent f73456e commit 5f203e9

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/manipulation/support.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ define( [
2626
// Make sure textarea (and checkbox) defaultValue is properly cloned
2727
div.innerHTML = "<textarea>x</textarea>";
2828
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
29+
30+
// Support: IE <=9 only
31+
// IE <=9 replaces <option> tags with their contents when inserted outside of
32+
// the select element.
33+
div.innerHTML = "<option></option>";
34+
support.option = !!div.lastChild;
2935
} )();
3036

3137
return support;

src/manipulation/wrapMap.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
define( function() {
1+
define( [
2+
"./support"
3+
], function( support ) {
24

35
// We have to close these tags to support XHTML (#13200)
46
var wrapMap = {
57

6-
// Support: IE9
7-
option: [ 1, "<select multiple='multiple'>", "</select>" ],
88

99
// XHTML parsers do not magically insert elements in the
1010
// same way that tag soup parsers do. So we cannot shorten
@@ -17,11 +17,14 @@ var wrapMap = {
1717
_default: [ 0, "", "" ]
1818
};
1919

20-
// Support: IE9
21-
wrapMap.optgroup = wrapMap.option;
2220

2321
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
2422
wrapMap.th = wrapMap.td;
2523

24+
// Support: IE <=9 only
25+
if ( !support.option ) {
26+
wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
27+
}
28+
2629
return wrapMap;
2730
} );

0 commit comments

Comments
 (0)
0