"../core",
"./var/rsingleTag",
- "../manipulation" // buildFragment
-], function( jQuery, rsingleTag ) {
+ // This is the only module that needs core/support
+ "./support",
+
+ // buildFragment
+ "../manipulation"
+], function( jQuery, rsingleTag, support ) {
// data: string of html
// context (optional): If specified, the fragment will be created in this context,
keepScripts = context;
context = false;
}
- context = context || document;
+ // document.implementation stops scripts or inline event handlers from
+ // being executed immediately
+ context = context || ( support.createHTMLDocument ?
+ document.implementation.createHTMLDocument( "" ) :
+ document );
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];
--- /dev/null
+define([
+ "../var/support"
+], function( support ) {
+
+support.createHTMLDocument = (function() {
+ var doc = document.implementation.createHTMLDocument( "" );
+ doc.body.innerHTML = "<form></form><form></form>";
+ return doc.body.childNodes.length === 2;
+})();
+
+return support;
+});
/**
* Run in noConflict mode
*/
- if (jQuery.noConflict) {
+ if ( jQuery.noConflict ) {
jQuery.noConflict();
}
});
// This is not run in AMD mode
-if (jQuery.noConflict) {
+if ( jQuery.noConflict ) {
test("noConflict", function() {
expect(7);
ok( jQuery.parseHTML("<#if><tr><p>This is a test.</p></tr><#/if>") || true, "Garbage input should not cause error" );
});
+if ( jQuery.support.createHTMLDocument ) {
+ asyncTest("jQuery.parseHTML", function() {
+ expect ( 1 );
+
+ Globals.register("parseHTMLError");
+
+ 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);
+ });
+}
+
test("jQuery.parseJSON", function() {
expect( 20 );
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
+ "createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"checkOn": true,
"clearCloneStyle": false,
"cors": true,
+ "createHTMLDocument": true,
"focusinBubbles": true,
"noCloneChecked": false,
"optDisabled": true,
"checkOn": true,
"clearCloneStyle": false,
"cors": false,
+ "createHTMLDocument": true,
"focusinBubbles": true,
"noCloneChecked": false,
"optDisabled": true,
"radioValue": false,
"reliableMarginRight": true
};
- } else if ( /(6|7|8)\.0(\.\d+|) safari/i.test( userAgent ) ) {
+ } else if ( /(6|7)\.0(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
+ "createHTMLDocument": true,
+ "focusinBubbles": false,
+ "noCloneChecked": true,
+ "optDisabled": true,
+ "optSelected": true,
+ "pixelPosition": false,
+ "radioValue": true,
+ "reliableMarginRight": true
+ };
+ } else if ( /8.0(\.\d+|) safari/i.test( userAgent ) ) {
+ expected = {
+ "ajax": true,
+ "boxSizingReliable": true,
+ "checkClone": true,
+ "checkOn": true,
+ "clearCloneStyle": true,
+ "cors": true,
+ "createHTMLDocument": false,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
+ "createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
+ "createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"checkOn": false,
"clearCloneStyle": true,
"cors": true,
+ "createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"checkOn": false,
"clearCloneStyle": false,
"cors": true,
+ "createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": false,