diff options
-rw-r--r-- | src/manipulation/support.js | 6 | ||||
-rw-r--r-- | src/manipulation/wrapMap.js | 15 | ||||
-rw-r--r-- | test/unit/support.js | 13 |
3 files changed, 27 insertions, 7 deletions
diff --git a/src/manipulation/support.js b/src/manipulation/support.js index 4a5d9af4c..62d6bb3e0 100644 --- a/src/manipulation/support.js +++ b/src/manipulation/support.js @@ -28,6 +28,12 @@ define( [ // Make sure textarea (and checkbox) defaultValue is properly cloned div.innerHTML = "<textarea>x</textarea>"; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; + + // Support: IE <=9 only + // IE <=9 replaces <option> tags with their contents when inserted outside of + // the select element. + div.innerHTML = "<option></option>"; + support.option = !!div.lastChild; } )(); return support; diff --git a/src/manipulation/wrapMap.js b/src/manipulation/wrapMap.js index 1f446f7d7..da48bf9fe 100644 --- a/src/manipulation/wrapMap.js +++ b/src/manipulation/wrapMap.js @@ -1,13 +1,12 @@ -define( function() { +define( [ + "./support" +], function( support ) { "use strict"; // We have to close these tags to support XHTML (#13200) var wrapMap = { - // Support: IE <=9 only - option: [ 1, "<select multiple='multiple'>", "</select>" ], - // XHTML parsers do not magically insert elements in the // same way that tag soup parsers do. So we cannot shorten // this by omitting <tbody> or other required elements. @@ -19,11 +18,13 @@ var wrapMap = { _default: [ 0, "", "" ] }; -// Support: IE <=9 only -wrapMap.optgroup = wrapMap.option; - wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; +// Support: IE <=9 only +if ( !support.option ) { + wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; +} + return wrapMap; } ); diff --git a/test/unit/support.js b/test/unit/support.js index e293c7423..dde4e4197 100644 --- a/test/unit/support.js +++ b/test/unit/support.js @@ -68,6 +68,7 @@ testIframe( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, + "option": true, "optSelected": true, "pixelBoxStyles": true, "pixelPosition": true, @@ -86,6 +87,7 @@ testIframe( "createHTMLDocument": true, "focusin": true, "noCloneChecked": false, + "option": true, "optSelected": false, "pixelBoxStyles": true, "pixelPosition": true, @@ -104,6 +106,7 @@ testIframe( "createHTMLDocument": true, "focusin": true, "noCloneChecked": false, + "option": false, "optSelected": false, "pixelBoxStyles": true, "pixelPosition": true, @@ -122,6 +125,7 @@ testIframe( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, + "option": true, "optSelected": true, "pixelBoxStyles": true, "pixelPosition": true, @@ -140,6 +144,7 @@ testIframe( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, + "option": true, "optSelected": true, "pixelBoxStyles": true, "pixelPosition": true, @@ -158,6 +163,7 @@ testIframe( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, + "option": true, "optSelected": true, "pixelBoxStyles": false, "pixelPosition": false, @@ -176,6 +182,7 @@ testIframe( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, + "option": true, "optSelected": true, "pixelBoxStyles": true, "pixelPosition": true, @@ -194,6 +201,7 @@ testIframe( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, + "option": true, "optSelected": true, "pixelBoxStyles": true, "pixelPosition": true, @@ -212,6 +220,7 @@ testIframe( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, + "option": true, "optSelected": true, "pixelBoxStyles": true, "pixelPosition": true, @@ -230,6 +239,7 @@ testIframe( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, + "option": true, "optSelected": true, "pixelBoxStyles": false, "pixelPosition": false, @@ -248,6 +258,7 @@ testIframe( "createHTMLDocument": false, "focusin": false, "noCloneChecked": true, + "option": true, "optSelected": true, "pixelBoxStyles": false, "pixelPosition": false, @@ -266,6 +277,7 @@ testIframe( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, + "option": true, "optSelected": true, "pixelBoxStyles": false, "pixelPosition": false, @@ -284,6 +296,7 @@ testIframe( "createHTMLDocument": true, "focusin": false, "noCloneChecked": true, + "option": true, "optSelected": true, "pixelBoxStyles": false, "pixelPosition": false, |