From 76df9e4e389d80bff410a9e5f08b848de1d21a2f Mon Sep 17 00:00:00 2001 From: Michał Gołębiowski Date: Thu, 11 Sep 2014 15:18:34 -0500 Subject: Build: Don't assume the browser environment; smoke test on Node w/ jsdom Fixes gh-1950 Closes gh-1949 --- src/ajax/parseXML.js | 2 +- src/ajax/script.js | 3 ++- src/ajax/var/location.js | 3 +++ src/ajax/xhr.js | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 src/ajax/var/location.js (limited to 'src/ajax') diff --git a/src/ajax/parseXML.js b/src/ajax/parseXML.js index 6a40c854a..962dc8887 100644 --- a/src/ajax/parseXML.js +++ b/src/ajax/parseXML.js @@ -11,7 +11,7 @@ jQuery.parseXML = function( data ) { // Support: IE9 try { - xml = ( new DOMParser() ).parseFromString( data, "text/xml" ); + xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); } catch ( e ) { xml = undefined; } diff --git a/src/ajax/script.js b/src/ajax/script.js index e5ad4d8f9..bf5f91d53 100644 --- a/src/ajax/script.js +++ b/src/ajax/script.js @@ -1,7 +1,8 @@ define([ "../core", + "../var/document", "../ajax" -], function( jQuery ) { +], function( jQuery, document ) { // Install script dataType jQuery.ajaxSetup({ diff --git a/src/ajax/var/location.js b/src/ajax/var/location.js new file mode 100644 index 000000000..4c9cf4a4c --- /dev/null +++ b/src/ajax/var/location.js @@ -0,0 +1,3 @@ +define(function() { + return window.location; +}); diff --git a/src/ajax/xhr.js b/src/ajax/xhr.js index 32afd2309..c1aceaa4a 100644 --- a/src/ajax/xhr.js +++ b/src/ajax/xhr.js @@ -6,7 +6,7 @@ define([ jQuery.ajaxSettings.xhr = function() { try { - return new XMLHttpRequest(); + return new window.XMLHttpRequest(); } catch ( e ) {} }; -- cgit v1.2.3