Bug 19122 - XMLHttpRequest should use a more reasonable method to serialize documents
Summary: XMLHttpRequest should use a more reasonable method to serialize documents
Status: RESOLVED DUPLICATE of bug 18421
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://lists.w3.org/Archives/Public/p...
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-18 22:19 PDT by Alexey Proskuryakov
Modified: 2008-05-19 10:17 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2008-05-18 22:19:06 PDT
From the bug URL:

---------------------------
   var doc = document.implementation.createDocument("", "", null);
   var el = doc.createElementNS("ns1", "x:y");
   el.setAttributeNS("ns2", "x:z", "val");
   doc.appendChild(el);
   var xhr = new XMLHttpRequest();
   xhr.open("POST", "echo.cgi", false);
   xhr.send(doc);
   alert(xhr.responseText);

Here echo.cgi is the following CGI:

   #!/usr/bin/perl 

   print "Content-Type: text/plain\n\n";
   while (<>) {
     print;
   }

Here are the results I see:

   Firefox 3rc1:

     <x:y xmlns:x="ns1" a0:z="val" xmlns:a0="ns2"/>

   Opera 9.25:

     <?xml version="1.0"?><x:y x:z="val" xmlns:x="ns1"/>

   Safari 3.1:

     <x:y x:z="val" />

Ignoring the Safari serialization, which is not in fact ns-wellformed no matter 
how you slice it, the other two are ns-wellformed XML.  Neither one roundtrips 
to quite the original document.  Which one is "correct" per the current spec? 
Or is it neither one?  Should an exception have been thrown in this case?  Why 
or why not?  If there shouldn't have been an exception in this case, how is a UA 
to determine that?
---------------------------

JSXMLHttpRequest uses Document::toString(), which is a weird method, see also: bug 18421.
Comment 1 Alexey Proskuryakov 2008-05-19 10:17:26 PDT
Will attach a fix to bug 18421.

*** This bug has been marked as a duplicate of 18421 ***