W3C home > Mailing lists > Public > public-webapi@w3.org > July 2007

Re: [XHR] Editorial and comments

From: Hallvord R. M. Steen <hallvord@opera.com>
Date: Mon, 23 Jul 2007 16:06:02 +0200
To: David Håsäther <hasather@gmail.com>, public-webapi@w3.org
Message-ID: <op.tvw39ndha3v5gv@hr-opera.oslo.opera.com>

On Thu, 19 Jul 2007 22:24:14 +0200, David Håsäther <hasather@gmail.com>  
wrote:

> 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 output of the custom toString() should be used if toString is  
overridden.

However, your test isn't testing the scenario you want to test because  
stringification of a number literal does not use  
Number.prototype.toString(). Say

request.send(new Number(1));

for example.

Opera not sending anything looks like a bug, I'll file it.

-- 
Hallvord R. M. Steen
Core QA JavaScript tester, Opera Software
http://www.opera.com/
Opera - simply the best Internet experience
Received on Monday, 23 July 2007 14:03:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:58 GMT