diff options
Diffstat (limited to 'node_modules/jquery/src/ajax/parseXML.js')
-rw-r--r-- | node_modules/jquery/src/ajax/parseXML.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/node_modules/jquery/src/ajax/parseXML.js b/node_modules/jquery/src/ajax/parseXML.js new file mode 100644 index 0000000000..6599aaf5be --- /dev/null +++ b/node_modules/jquery/src/ajax/parseXML.js @@ -0,0 +1,27 @@ +define( [ + "../core" +], function( jQuery ) { + +// Cross-browser xml parsing +jQuery.parseXML = function( data ) { + var xml; + if ( !data || typeof data !== "string" ) { + return null; + } + + // Support: IE9 + try { + xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); + } catch ( e ) { + xml = undefined; + } + + if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; +}; + +return jQuery.parseXML; + +} ); |