]> source.dussan.org Git - jquery.git/commitdiff
2.0: Reduced parseXML
authorRick Waldron <waldron.rick@gmail.com>
Mon, 17 Dec 2012 22:41:38 +0000 (17:41 -0500)
committerRick Waldron <waldron.rick@gmail.com>
Wed, 26 Dec 2012 18:34:37 +0000 (13:34 -0500)
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
src/core.js

index 96a68c2e660becb83705b989c85ec3782003110c..55ed4317f4b8cbf5353cfbbfbe6f1f602e6fccba 100644 (file)
@@ -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;