Detecting the "type" of a DOM object

Brendan Eich brendan at mozilla.org
Fri Jun 22 09:41:10 PDT 2012


Allen Wirfs-Brock wrote:
> I agree, I don't see that it presents any technical hurdles.

Agreed.

The DOM is alas built from nominal types, so many people believe (x 
instaceof I) for some WebIDL-declared interface I, even if that I came 
from another window or frame, "should just work".

Of course, if the other frame's I.prototype has been extended with a 
quux property, x won't inherit that property. But that's not how 
instanceof is used with DOM interfaces, at least.

At this point I am in favor of making instanceof more useful for WebIDL 
consumers, than in being pedantic about prototype chains and multiple 
global objects.

/be


More information about the es-discuss mailing list