aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2014-12-09 15:57:12 -0500
committerTimmy Willison <timmywillisn@gmail.com>2014-12-09 15:57:12 -0500
commit59232825aa87b941dd2418a6860b64017dfec0ae (patch)
tree1b12357b493dc2264bc6204c93c1e30e8c74771d
parent6051609df35ef5e478c79c76534c03e4b46100bf (diff)
downloadjquery-59232825aa87b941dd2418a6860b64017dfec0ae.tar.gz
jquery-59232825aa87b941dd2418a6860b64017dfec0ae.zip
Core: remove unnecessary support test for createHTMLDocument
-rw-r--r--src/core.js2
-rw-r--r--src/core/parseHTML.js7
-rw-r--r--src/core/support.js8
-rw-r--r--test/unit/core.js24
-rw-r--r--test/unit/support.js8
5 files changed, 13 insertions, 36 deletions
diff --git a/src/core.js b/src/core.js
index dab633f9c..fa8436a01 100644
--- a/src/core.js
+++ b/src/core.js
@@ -7,7 +7,7 @@ define([
"./var/class2type",
"./var/toString",
"./var/hasOwn",
- "./core/support"
+ "./var/support"
], function( arr, slice, concat, push, indexOf, class2type, toString, hasOwn, support ) {
var
diff --git a/src/core/parseHTML.js b/src/core/parseHTML.js
index c441b2b92..f4448b7b1 100644
--- a/src/core/parseHTML.js
+++ b/src/core/parseHTML.js
@@ -1,10 +1,9 @@
define([
"../core",
"./var/rsingleTag",
- "./support",
"../manipulation" // buildFragment
-], function( jQuery, rsingleTag, support ) {
+], function( jQuery, rsingleTag ) {
// data: string of html
// context (optional): If specified, the fragment will be created in this context,
@@ -20,9 +19,7 @@ jQuery.parseHTML = function( data, context, keepScripts ) {
}
// document.implementation stops scripts or inline event handlers from
// being executed immediately
- context = context || ( support.createHTMLDocument ?
- document.implementation.createHTMLDocument() :
- document );
+ context = context || document.implementation.createHTMLDocument();
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];
diff --git a/src/core/support.js b/src/core/support.js
deleted file mode 100644
index d3ed33c04..000000000
--- a/src/core/support.js
+++ /dev/null
@@ -1,8 +0,0 @@
-define([
- "../var/support"
-], function( support ) {
- // window.document is used here as it's before the sandboxed document
- support.createHTMLDocument = !!window.document.implementation.createHTMLDocument;
-
- return support;
-});
diff --git a/test/unit/core.js b/test/unit/core.js
index ce3c3184d..c4c5ffa1a 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -1370,23 +1370,19 @@ test("jQuery.parseHTML", function() {
ok( jQuery.parseHTML("<#if><tr><p>This is a test.</p></tr><#/if>") || true, "Garbage input should not cause error" );
});
-// This XSS test is optional, as it will only pass when `document.implementation.createHTMLDocument`
-// is implemented. This might not be the case for older Android browsers (<= 2.x).
-if ( document.implementation.createHTMLDocument ) {
- asyncTest("jQuery.parseHTML", function() {
- expect ( 1 );
+asyncTest("jQuery.parseHTML", function() {
+ expect ( 1 );
- Globals.register("parseHTMLError");
+ Globals.register("parseHTMLError");
- jQuery.globalEval("parseHTMLError = false;");
- jQuery.parseHTML( "<img src=x onerror='parseHTMLError = true'>" );
+ jQuery.globalEval("parseHTMLError = false;");
+ jQuery.parseHTML( "<img src=x onerror='parseHTMLError = true'>" );
- window.setTimeout(function() {
- start();
- equal( window.parseHTMLError, false, "onerror eventhandler has not been called." );
- }, 2000);
- });
-}
+ window.setTimeout(function() {
+ start();
+ equal( window.parseHTMLError, false, "onerror eventhandler has not been called." );
+ }, 2000);
+});
test("jQuery.parseJSON", function() {
expect( 20 );
diff --git a/test/unit/support.js b/test/unit/support.js
index bed2c0414..11f15a33b 100644
--- a/test/unit/support.js
+++ b/test/unit/support.js
@@ -61,7 +61,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
- "createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
@@ -78,7 +77,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"checkOn": true,
"clearCloneStyle": false,
"cors": true,
- "createHTMLDocument": true,
"focusinBubbles": true,
"noCloneChecked": false,
"optDisabled": true,
@@ -95,7 +93,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"checkOn": true,
"clearCloneStyle": false,
"cors": false,
- "createHTMLDocument": true,
"focusinBubbles": true,
"noCloneChecked": false,
"optDisabled": true,
@@ -112,7 +109,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
- "createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
@@ -129,7 +125,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
- "createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
@@ -146,7 +141,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
- "createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
@@ -163,7 +157,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"checkOn": false,
"clearCloneStyle": true,
"cors": true,
- "createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
@@ -180,7 +173,6 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"checkOn": false,
"clearCloneStyle": false,
"cors": true,
- "createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": false,