Skip to content
Permalink
Browse files

2.0: Reduced parseXML

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
  • Loading branch information
rwaldron committed Dec 17, 2012
1 parent 338eaf6 commit 155dbad029e001f4752a4aedc901cf950ebfe64d
Showing with 7 additions and 10 deletions.
  1. +7 −10 src/core.js
@@ -486,19 +486,16 @@ jQuery.extend({
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;

0 comments on commit 155dbad

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