On Thu, May 19, 2011 at 2:52 PM, Kevin Reid <[email protected]> wrote:
> Context: My project is to write DOMado, the "real" DOM taming, in terms of > ES5 rather than Cajita-runtime taming facilities. > > It was suggested to use proxies to do so. However, the bulk of the DOM > taming is defined as some sort of property getters and setters, or can be. > > Is there any reason that DOMado tame nodes should be proxies rather than > objects using Object.defineProperty -- some real-DOM behavior which requires > proxies to emulate? > > The one I can see is if it is desirable for expando properties to be shared > among all sandboxes (as they currently are, stored in node.properties___) > rather than being specific to a sandbox (stored on the tame-nodes). Even so, > we could use the design where the prototype of an object is a proxy, thus > getting catch-all for unknown property names while still using the > ES5-builtin property descriptor features for the ordinary case (thus > hopefully reducing dispatch overhead in a real-ES5 world). > Yes, a regular object inheriting from a proxy < http://wiki.ecmascript.org/doku.php?id=harmony:proxies#simulating_nosuchmethod_doesnotunderstand> is the right pattern here. Sorry for not pointing that out earlier. -- Cheers, --MarkM
