Skip to content

Commit f345291

Browse files
committed
Manipulation: Use textarea for missing IE defaultValue check
IE11 fixed the checkbox defaultValue issue but not textarea. Rather than creating a new detect name I'm reusing the old one to protect anyone who is unwisely using this externally. Re-fixing the defaultValue when it doesn't need to be done is not a problem, so leave that code for IE11. Fixes #14716 Closes jquerygh-1495
1 parent 49b03cf commit f345291

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/manipulation/support.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ define([
77
div = document.createElement("div"),
88
input = document.createElement("input");
99

10-
input.type = "checkbox";
11-
1210
// Setup
1311
div.setAttribute( "className", "t" );
1412
div.innerHTML = " <link/><table></table><a href='/a'>a</a>";
@@ -29,15 +27,18 @@ define([
2927
support.html5Clone =
3028
document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";
3129

32-
// Make sure checked status is properly cloned
33-
input.checked = true;
34-
support.noCloneChecked = input.cloneNode( true ).checked;
35-
3630
// Check if a disconnected checkbox will retain its checked
3731
// value of true after appended to the DOM (IE6/7)
32+
input.type = "checkbox";
33+
input.checked = true;
3834
fragment.appendChild( input );
3935
support.appendChecked = input.checked;
4036

37+
// Make sure textarea (and checkbox) defaultValue is properly cloned
38+
// Support: IE6-IE11+
39+
div.innerHTML = "<textarea>x</textarea>";
40+
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
41+
4142
// #11217 - WebKit loses check when the name is after the checked attribute
4243
fragment.appendChild( div );
4344
div.innerHTML = "<input type='radio' checked='checked' name='t'/>";

test/unit/support.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
178178
"inlineBlockNeedsLayout": false,
179179
"input": true,
180180
"leadingWhitespace": true,
181-
"noCloneChecked": true,
181+
"noCloneChecked": false,
182182
"noCloneEvent": true,
183183
"opacity": true,
184184
"optDisabled": true,

0 commit comments

Comments
 (0)