Skip to content

Commit 5923282

Browse files
committed
Core: remove unnecessary support test for createHTMLDocument
1 parent 6051609 commit 5923282

File tree

5 files changed

+13
-36
lines changed

5 files changed

+13
-36
lines changed

src/core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ define([
77
"./var/class2type",
88
"./var/toString",
99
"./var/hasOwn",
10-
"./core/support"
10+
"./var/support"
1111
], function( arr, slice, concat, push, indexOf, class2type, toString, hasOwn, support ) {
1212

1313
var

src/core/parseHTML.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
define([
22
"../core",
33
"./var/rsingleTag",
4-
"./support",
54

65
"../manipulation" // buildFragment
7-
], function( jQuery, rsingleTag, support ) {
6+
], function( jQuery, rsingleTag ) {
87

98
// data: string of html
109
// context (optional): If specified, the fragment will be created in this context,
@@ -20,9 +19,7 @@ jQuery.parseHTML = function( data, context, keepScripts ) {
2019
}
2120
// document.implementation stops scripts or inline event handlers from
2221
// being executed immediately
23-
context = context || ( support.createHTMLDocument ?
24-
document.implementation.createHTMLDocument() :
25-
document );
22+
context = context || document.implementation.createHTMLDocument();
2623

2724
var parsed = rsingleTag.exec( data ),
2825
scripts = !keepScripts && [];

src/core/support.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

test/unit/core.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,23 +1370,19 @@ test("jQuery.parseHTML", function() {
13701370
ok( jQuery.parseHTML("<#if><tr><p>This is a test.</p></tr><#/if>") || true, "Garbage input should not cause error" );
13711371
});
13721372

1373-
// This XSS test is optional, as it will only pass when `document.implementation.createHTMLDocument`
1374-
// is implemented. This might not be the case for older Android browsers (<= 2.x).
1375-
if ( document.implementation.createHTMLDocument ) {
1376-
asyncTest("jQuery.parseHTML", function() {
1377-
expect ( 1 );
1373+
asyncTest("jQuery.parseHTML", function() {
1374+
expect ( 1 );
13781375

1379-
Globals.register("parseHTMLError");
1376+
Globals.register("parseHTMLError");
13801377

1381-
jQuery.globalEval("parseHTMLError = false;");
1382-
jQuery.parseHTML( "<img src=x onerror='parseHTMLError = true'>" );
1378+
jQuery.globalEval("parseHTMLError = false;");
1379+
jQuery.parseHTML( "<img src=x onerror='parseHTMLError = true'>" );
13831380

1384-
window.setTimeout(function() {
1385-
start();
1386-
equal( window.parseHTMLError, false, "onerror eventhandler has not been called." );
1387-
}, 2000);
1388-
});
1389-
}
1381+
window.setTimeout(function() {
1382+
start();
1383+
equal( window.parseHTMLError, false, "onerror eventhandler has not been called." );
1384+
}, 2000);
1385+
});
13901386

13911387
test("jQuery.parseJSON", function() {
13921388
expect( 20 );

test/unit/support.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
6161
"checkOn": true,
6262
"clearCloneStyle": true,
6363
"cors": true,
64-
"createHTMLDocument": true,
6564
"focusinBubbles": false,
6665
"noCloneChecked": true,
6766
"optDisabled": true,
@@ -78,7 +77,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
7877
"checkOn": true,
7978
"clearCloneStyle": false,
8079
"cors": true,
81-
"createHTMLDocument": true,
8280
"focusinBubbles": true,
8381
"noCloneChecked": false,
8482
"optDisabled": true,
@@ -95,7 +93,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
9593
"checkOn": true,
9694
"clearCloneStyle": false,
9795
"cors": false,
98-
"createHTMLDocument": true,
9996
"focusinBubbles": true,
10097
"noCloneChecked": false,
10198
"optDisabled": true,
@@ -112,7 +109,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
112109
"checkOn": true,
113110
"clearCloneStyle": true,
114111
"cors": true,
115-
"createHTMLDocument": true,
116112
"focusinBubbles": false,
117113
"noCloneChecked": true,
118114
"optDisabled": true,
@@ -129,7 +125,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
129125
"checkOn": true,
130126
"clearCloneStyle": true,
131127
"cors": true,
132-
"createHTMLDocument": true,
133128
"focusinBubbles": false,
134129
"noCloneChecked": true,
135130
"optDisabled": true,
@@ -146,7 +141,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
146141
"checkOn": true,
147142
"clearCloneStyle": true,
148143
"cors": true,
149-
"createHTMLDocument": true,
150144
"focusinBubbles": false,
151145
"noCloneChecked": true,
152146
"optDisabled": true,
@@ -163,7 +157,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
163157
"checkOn": false,
164158
"clearCloneStyle": true,
165159
"cors": true,
166-
"createHTMLDocument": true,
167160
"focusinBubbles": false,
168161
"noCloneChecked": true,
169162
"optDisabled": true,
@@ -180,7 +173,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
180173
"checkOn": false,
181174
"clearCloneStyle": false,
182175
"cors": true,
183-
"createHTMLDocument": true,
184176
"focusinBubbles": false,
185177
"noCloneChecked": true,
186178
"optDisabled": false,

0 commit comments

Comments
 (0)