07.06.2012, 01:35, "Boris Zbarsky" <bzbarsky@MIT.EDU>: >> šWhile it wouldn't be perfectly future-proof (since new subclass of Nodes >> šcan come along later), the technique I've explained above does work >> šacross globals. > > For the specific cast of Node... last I checked, there are 100+ > subclasses of Node in the platform, with new ones being added about > monthly. šThe technique you described simply doesn't work for nodes.... FWIW: PHP has `is_a(object $object, string $class_name)` function [1] that checks if the object is of specific class OR has that class as one of its parents. Probably, JavaScript should have a similar method sothat we could check, for example, if an object is a DOM node or an instance of one of its subclasses without (redundant and non-future-proof) need to go over each of existing subclasses explicitly. [1] http://ru2.php.net/manual/en/function.is-a.phpReceived on Thursday, 7 June 2012 13:09:26 UTC
This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:06 UTC