Re: Detecting the "type" of a DOM object

* Boris Zbarsky wrote:
>There's a common problem where someone has an object and they would like 
>to tell whether it's a Node (or an Array or a Date or whatever).  Right 
>now, the way to do that is to use instanceof.... but with a huge caveat: 
>you have to pull the Node or Array or whatnot off the right global object.
>
>I was wondering whether it would make sense to expose, on DOM 
>constructor objects, a method that lets you test whether some other 
>object is of that type.

Would you prefer such a method over having a proper `instanceof`-like
operator on the language level that does not have the problem you cite?
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Thursday, 21 June 2012 04:03:33 UTC