- From: Cameron McCormack <cam@mcc.id.au>
- Date: Thu, 07 Jun 2012 15:47:44 +1000
- To: Boris Zbarsky <bzbarsky@MIT.EDU>
- CC: "public-script-coord@w3.org" <public-script-coord@w3.org>
Boris Zbarsky: > So you would be to do something like Node.isInstanceOf(myobj) (or > something along those lines) and this would return true if myobj is a > Node, even if it's a Node from a different global. > > Thoughts? This is somewhat similar to the Array.isArray thing ES > already has... I think that's a good idea. If we wanted to follow the Array.isArray pattern then we could have Node.isNode, etc., but that might get a bit wordy at times (HTMLDivElement.isHTMLDivElement?). > There are some complications with WebIDL "implements" statements that > I'm not sure how to deal with, but I think it's pretty rare for people > to worry about whether something is an instance of the RHS of an > "implements". Not sure how useful it is. They're not counted when you do an instanceof currently, either, since that just does the default thing of looking up the prototype chain. The pattern spec writers tend to use for interfaces that appear on the RHS of an implements statement is to make it [NoInterfaceObject] anyway, unless there's a clear need not to.
Received on Thursday, 7 June 2012 05:48:16 UTC