Skip to content
Permalink
Browse files

jQuery.parseXML extracted from ajax & added to core, needs unit testing.

  • Loading branch information...
unknown unknown
unknown authored and unknown committed Dec 24, 2010
1 parent 8ece429 commit 11642ba20c10ced6363d81d6e3a0239ac10dab27
Showing with 22 additions and 0 deletions.
  1. +22 −0 src/core.js
@@ -546,6 +546,28 @@ jQuery.extend({
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() {},

0 comments on commit 11642ba

Please sign in to comment.
You can’t perform that action at this time.