Re: Detecting the "type" of a DOM object

On 6/20/12 11:20 PM, Cameron McCormack wrote:
> I think what I really want to write is:
>
> if (n.is(Node))
> ...
>
> but I don't think that will fly.

What if we used a catapult?  It looks _really_ nice.  ;)

The real problem with it is that it will throw for random non-DOM 
objects, which we really can't require to have is() on them....

How much would people hate a "n is Node" language feature akin to 
instanceof but more flexible?

Alternately, we could try to make instanceof actually work cross-global?

> Node.isInterfaceOf(n)
> Node.isImplementedBy(n)

I like these two, I guess, of the list of suggestions.

-Boris

Received on Thursday, 21 June 2012 05:30:34 UTC