mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
jQuery.parseXML extracted from ajax & added to core, needs unit testing.
This commit is contained in:
parent
8ece429d12
commit
11642ba20c
22
src/core.js
22
src/core.js
@ -546,6 +546,28 @@ jQuery.extend({
|
|||||||
jQuery.error( "Invalid JSON: " + data );
|
jQuery.error( "Invalid JSON: " + data );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Cross-browser xml parsing
|
||||||
|
// (xml & tmp used internally)
|
||||||
|
parseXML: function( data , xml , tmp ) {
|
||||||
|
|
||||||
|
if ( window.DOMParser ) { // Standard
|
||||||
|
tmp = new DOMParser();
|
||||||
|
xml = tmp.parseFromString( data , "text/xml" );
|
||||||
|
} else { // IE
|
||||||
|
xml = new ActiveXObject( "Microsoft.XMLDOM" );
|
||||||
|
xml.async = "false";
|
||||||
|
xml.loadXML( data );
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp = xml.documentElement;
|
||||||
|
|
||||||
|
if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {
|
||||||
|
jQuery.error( "Invalid XML: " + data );
|
||||||
|
}
|
||||||
|
|
||||||
|
return xml;
|
||||||
|
},
|
||||||
|
|
||||||
noop: function() {},
|
noop: function() {},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user