Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
if ( !data || typeof data !== "string" ) {
return null;
}
+
+ // IE9 will throw on ill-formed XML
try {
- 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 );
- }
- } catch( e ) {
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data , "text/xml" );
+ } catch ( e ) {
xml = undefined;
}
- if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
+
+ if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;