API to identify host objects

Irakli Gozalishvili rfobic at gmail.com
Mon Nov 12 14:12:02 PST 2012


Lately I have being struggling with an implementation differences of host (DOM) objects across the browsers.
So far only reliable way I could find to identify host objects is by a following assertion:

object.constructor.call === void(0)

Behaviour seems to be consistent across FF, Opera, Safari, and Chrome (Don't have windows to test on IE).
I think it would be great if there was some standardised way to identify host objects.

My personal use case is polymorphic method dispatch library https://github.com/Gozala/method that has same semantics as
clojure protocols. Method implementations for host objects and built-ins are stored in the separate dictionary to avoid memory leaks and to support objects from diff JS contexts / frames / compartments.


If you know of a better of identifying host objects I would really love to know that too. 

Regards
--
Irakli Gozalishvili
Web: http://www.jeditoolkit.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121112/4d92d2d4/attachment.html>


More information about the es-discuss mailing list