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:51:14 -0500
Message-ID: <50F87252.80105@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:48 PM, Travis Leithead wrote:
>> So "x instanceof Element" would be true if x is an Element, no matter what
>> its owner document is.
>
> I don't think that's quite what you want. For multiple documents inside of a single window instance this is already true:

Sure, but it's not true for documents in general.

> I think you are asking that when comparing instances of elements originating from two different window objects the instanceof check can return true.

Yes, indeed.  Saying that it's true for all ownerDocuments implies that 
it's also true for ones from other windows.

> Will this be new ECMAScript 6 behavior for instanceof

ES6 has a new trap that allows the RHS of instanceof to return whatever 
value it wants, basically.  I'm proposing that WebIDL define this trap 
for WebIDL interface objects to return whether the LHS implements the 
given interface.

-Boris
Received on Thursday, 17 January 2013 21:51:43 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:08 UTC