[XHR] Editorial and comments

Some comments on the XMLHttpRequest draft.

The fourth step in the text response entity body algorithm[1] says:

   | If there is a Content-Type header contains a text/html MIME type [...]

It should probably say

   | If there is a Content-Type header which contains a text/html MIME type  
[...]



In the same algorithm, step six says:

   | If charset is "null" then, for each of the rows in the following table,
   | starting with the first one and going down, if the start of the entity
   | body (/bytes/) is equal to or greater than the number of bytes in the  
first
   | column, and the first bytes of /bytes/ match the bytes given in the  
first
   | column [...]

It can never match if the length of the entity body is less than the  
number of bytes in the first column, so it can probably be reworded as:

   | If charset is "null" then, for each of the rows in the following table,
   | starting with the first one and going down, if the first bytes of  
/bytes/
   | match the bytes given in the first column [...]



In the same step it says:

   | When an encoding is determined or when no encoding is determined go to  
the
   | next step

This text looks redundant.



One of the steps for the open() method[2] says:

   | Let async be the value of the async argument or true if it was omitted.

What happens if async is set to something other than false or true? Or is  
that covered somewhere else?



One of the steps for the send() method[3] says:

   | Use the stringification mechanisms of the host language on data and  
treat
   | the result as if data is a DOMString.

What should happen if toString() is overridden? E.g.:

   Number.prototype.toString = function() { return (this*2)+''; };
   ...
   request.send(1);

Should '1' or '2' be sent? I tested this in Opera 9.2 and Firefox 2. Opera  
doesn't seem to post anything when the parameter is a number. Firefox  
sends '1'.



The second to last step for the send() method says:

   | [...] Finally, if the complete resource has been downloaded go to the
   | next step.

This text might be redundant.



The last paragraph for the send() algorithm() says:

   | Responses to such requests must have the content-codings automatically
   | decoded.

s/content-codings/content-encodings/?



The third and fourth step for the getResponseHeader():

s/for the last request sent return the/for the last request sent, return  
the/ (added a comma for clarity).



[1]  
<http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070618/#text-response-entity-body>
[2] <http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070618/#dfn-open>
[3] <http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070618/#dfn-send>

-- 
David Håsäther

Received on Thursday, 19 July 2007 20:24:29 UTC