Re: Solving the "how do I tell whether I have an HTML element?" (or image element, or whatever) problem

On 1/17/13 4:27 PM, Travis Leithead wrote:
> This grabbed my attention :)

Oh, good.  This is only my third try at getting a response... ;)

> Is the idea to change the interface object such that instanceof can answer true for any instance of that type (from any Javascript engine instance)? For example:
>
> x instanceof Element === true
> (where x and Element are from different engine instances?

I'm not sure what you mean by "engine instance".

The proposal is that the expression "x instanceof Foo" where "Foo" is a 
WebIDL interface object for a non-callback interface as defined at 
http://dev.w3.org/2006/webapi/WebIDL/#interface-object will return true 
if and only "x" is a platform object implementing the relevant interface.

So "x instanceof Element" would be true if x is an Element, no matter 
what its owner document is.

-Boris

Received on Thursday, 17 January 2013 21:33:38 UTC