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

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