W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2013

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 17 Jan 2013 16:33:09 -0500
Message-ID: <50F86E15.3020401@mit.edu>
To: Travis Leithead <travis.leithead@microsoft.com>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>, es-discuss <es-discuss@mozilla.org>
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.

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:08 UTC