]> source.dussan.org Git - jquery.git/commitdiff
Never use the XML as parsed by the XHR instance. Use raw text instead and let the...
authorjaubourg <j@ubourg.net>
Mon, 21 Jan 2013 01:44:16 +0000 (02:44 +0100)
committerjaubourg <j@ubourg.net>
Mon, 21 Jan 2013 01:44:16 +0000 (02:44 +0100)
src/ajax/xhr.js
test/unit/ajax.js

index 3c1fde374c484ae0a7851c1b3dbd1755d8fc3985..2353392f6a4c8648e5031b6c5b387ef38220d9bf 100644 (file)
@@ -105,8 +105,7 @@ if ( xhrSupported ) {
                                                var status,
                                                        statusText,
                                                        responseHeaders,
-                                                       responses,
-                                                       xml;
+                                                       responses;
 
                                                // Firefox throws exceptions when accessing properties
                                                // of an xhr when a network error occurred
@@ -136,14 +135,8 @@ if ( xhrSupported ) {
                                                                } else {
                                                                        responses = {};
                                                                        status = xhr.status;
-                                                                       xml = xhr.responseXML;
                                                                        responseHeaders = xhr.getAllResponseHeaders();
 
-                                                                       // Construct response list
-                                                                       if ( xml && xml.documentElement /* #4958 */ ) {
-                                                                               responses.xml = xml;
-                                                                       }
-
                                                                        // When requesting binary data, IE6-9 will throw an exception
                                                                        // on any attempt to access responseText (#11426)
                                                                        if ( typeof xhr.responseText === "string" ) {
index f88b5d7ccb07ec0da8ff0e125640e330ad5f044a..86d1b191247a5ab16b7c7f5d926e669534011834 100644 (file)
@@ -1483,6 +1483,22 @@ module( "ajax", {
                
        });
 
+       ajaxTest( "#13276 - jQuery.ajax() - compatibility between XML documents from ajax requests and parsed string", 1, {
+               url: "data/dashboard.xml",
+               dataType: "xml",
+               success: function( ajaxXML ) {
+                       var parsedXML = jQuery( jQuery.parseXML("<tab title=\"Added\">blibli</tab>") ).find("tab");
+                       ajaxXML = jQuery( ajaxXML );
+                       try {
+                               ajaxXML.find("infowindowtab").append( parsedXML );
+                       } catch( e ) {
+                               strictEqual( e, undefined, "error" );
+                               return;
+                       }
+                       strictEqual( ajaxXML.find("tab").length, 3, "Parsed node was added properly" );
+               }
+       });
+
 //----------- jQuery.ajaxPrefilter()
 
        ajaxTest( "jQuery.ajaxPrefilter() - abort", 1, {