If the interface were implemented as-is, document.responseXML would just be a reference back to the document object.<br><br>So if the document is XML, then document === document.responseXML<br><br><br><div class="gmail_quote">
On Wed, Oct 29, 2008 at 12:14 PM, Kristof Zelechovski <span dir="ltr"><<a href="mailto:giecrilj@stegny.2a.pl">giecrilj@stegny.2a.pl</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="blue" lang="PL">
<div>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">What should the property "HTMLDocument.responseXML"
represent?</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US">Chris</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-US"> </span></font></p>
<div>
<div style="text-align: center;" align="center"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">
<hr align="center" size="2" width="100%">
</span></font></div>
<p><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;"> <a href="mailto:whatwg-bounces@lists.whatwg.org" target="_blank">whatwg-bounces@lists.whatwg.org</a>
[mailto:<a href="mailto:whatwg-bounces@lists.whatwg.org" target="_blank">whatwg-bounces@lists.whatwg.org</a>] <b><span style="font-weight: bold;">On
Behalf Of </span></b>Weston Ruter<br>
<b><span style="font-weight: bold;">Sent:</span></b> Wednesday, October 29, 2008
8:06 PM<br>
<b><span style="font-weight: bold;">To:</span></b> <a href="mailto:whatwg@whatwg.org" target="_blank">whatwg@whatwg.org</a><br>
<b><span style="font-weight: bold;">Cc:</span></b> Ian Hickson; Anne van Kesteren<br>
<b><span style="font-weight: bold;">Subject:</span></b> [whatwg] Implement
XMLHttpRequest interface subset on HTMLDocument</span></font></p>
</div><div><div></div><div class="Wj3C7c">
<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>
<div>
<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">I realized that the HTTP
response headers exposed in the <a href="http://www.w3.org/html/wg/html5/#htmldocument" target="_blank">HTMLDocument interface</a>
are limited: referrer, cookie, lastModified, charset, characterSet.<br>
<br>
It would be very useful if a script could get *all* of the response headers,
the raw entity body, and the HTTP status: basically it would be great if the
HTMLDocument interface implemented a subset of of the XMLHttpRequest spec,
namely the parts which have to do with the response (e.g.
getAllResponseHeaders(), getResponseHeader(), status, and others which appear
below). The HTMLDocument interface already has a readyState property which
XMLHttpRequest also has, but the HTMLDocument interface lacks XHR's onreadystatechange
attribute.<br>
<br>
If this subset were implemented on HTMLDocument, then scripts would be able to
determine if the page if a 404 or get any other arbitrary information that is
passed in the response header.<br>
<br>
Here's a proposed extension to the HTMLDocument interface with some comments to
explain the semantics:<br>
<br>
</span></font><font face="Courier New"><span>interface
HTMLDocument {<br>
...<br>
//another way to get DOMContentLoaded event; the readyState would start
out as LOADING<br>
attribute EventListener onreadystatechange;<br>
<br>
// state<br>
const unsigned short UNSENT = 0;<br>
const unsigned short OPENED = 1;<br>
const unsigned short HEADERS_RECEIVED = 2;<br>
const unsigned short LOADING = 3;<br>
const unsigned short DONE = 4;<br>
readonly attribute unsigned short readyState; //already in HTML 5<br>
<br>
// request<br>
void abort(); //complements window.stop(): stops the contained document
instead of the associated resources<br>
<br>
// response<br>
DOMString getAllResponseHeaders();<br>
DOMString getResponseHeader(in DOMString header);<br>
readonly attribute DOMString responseText; //the non-parsed content of
the document<br>
readonly attribute Document responseXML;<br>
readonly attribute unsigned short status;<br>
readonly attribute DOMString statusText;<br>
}</span></font></p>
</div>
</div></div></div>
</div>
</blockquote></div><br>