W3C home > Mailing lists > Public > public-webapi@w3.org > March 2008

Re: [Bindings] What does typeof return for interface objects?

From: Maciej Stachowiak <mjs@apple.com>
Date: Wed, 19 Mar 2008 00:23:45 -0700
Cc: Cameron McCormack <cam@mcc.id.au>, "Web APIs WG (public)" <public-webapi@w3.org>
Message-Id: <13A3D654-E18C-4E4B-A9BB-30E9AF4D3E51@apple.com>
To: Maciej Stachowiak <mjs@apple.com>

On Mar 19, 2008, at 12:08 AM, Maciej Stachowiak wrote:

> ECMA-262 actually allows typeof to return anything at all for host  
> objects (which all of the DOM binding objects are). So it would not  
> be an ECMA-262 violation, technically, for an uncallable object to  
> give typeof == 'function', but I do think it would be a bad idea.
> In WebKit we currently follow the ECMA-262 callability-based  
> approach even for host objects, but not all web engines do. For  
> example, I believe that in Trident, NodeLists are callable but give  
> a typeof result of 'object' instead of 'function'.

Alexey points out that we have had a bug filed because we report  
'function' in this case: <http://bugs.webkit.org/show_bug.cgi?id=14547>.

But it's not really clear if the IE behavior of being callable but  
reporting typeof == 'object' is required for compatibility (it is  
clear that NodeLists actually being callable is).

There is much more discussion in the bug.

Received on Wednesday, 19 March 2008 07:24:25 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:25 UTC