Solving the "how do I tell whether I have an HTML element?" (or image element, or whatever) problem
bzbarsky at MIT.EDU
Thu Jan 17 13:51:14 PST 2013
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
More information about the es-discuss