Re: Detecting the "type" of a DOM object

Boris Zbarsky wrote:
>> So in Firefox, instanceof can be used with browser API (DOM +
>> localStorage + XHR + whatev's is built-in to the browser)
>
> Stop right there. ;)  XHR has been switched to WebIDL bindings already 
> (to ship in Firefox 14 in a few weeks), so you _can't_ use instanceof 
> there anymore.  Other things will be following.  Hence this thread....

Seems better to discuss and possibly revise WebIDL (and ES6, but see 
below -- it may be ready!) first, then change Gecko, but sounds like 
time is short to undo the change.

>> Of course. Then +1000 for changing how instanceof is defined in WebIDL
>> to adopt Gecko behavior!
>
> The point is WebIDL can't do that on its own: there is nothing in ES5 
> for it to hook into, as far as I know.  This needs coordination 
> between WebIDL and the ES spec. 

See [[NativeBrand]] in ES6 drafts including latest at

http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts

/be

Received on Thursday, 21 June 2012 15:06:07 UTC