Cross-global instanceof

Anne van Kesteren annevk at annevk.nl
Thu Oct 31 08:38:18 PDT 2013


This keeps coming up. Last instance:
http://mxr.mozilla.org/mozilla-central/source/dom/base/ObjectWrapper.jsm#16

We have it for Array using Array.isArray(). It is unclear why the
arguments for arrays not apply to other types of objects, such as
array buffers, nodes, blobs, files, etc.

We could introduce something like

  Object.crossGlobalInstanceOf(instance, type)

which checks @@crossGlobalBrand or some such which works for built-ins
and is also usable by jQuery and the like.


-- 
http://annevankesteren.nl/


More information about the es-discuss mailing list