jQuery.parseXML extracted from ajax & added to core, needs unit testing.
This commit is contained in:
parent
5bfbe7eaf6
commit
524bf39400
22
src/core.js
22
src/core.js
|
@ -547,6 +547,28 @@ jQuery.extend({
|
|||
}
|
||||
},
|
||||
|
||||
// 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() {},
|
||||
|
||||
// Evalulates a script in a global context
|
||||
|
|
Loading…
Reference in a new issue