direct_proxies "problem"

Andrea Giammarchi andrea.giammarchi at
Sat Jan 12 12:58:00 PST 2013

that is a (quick/imperfect/asexample) way to detect a proxy while I
understand these should not be detectable.

Consider that as conditional check after node instanceof Element in order
to know if that node is usable or not as DOM element.

There, a way to simulate an isProxy method and it does not matter if that's
silly ... is possible

On Sat, Jan 12, 2013 at 11:24 AM, Brendan Eich <brendan at> wrote:

> This is silly.
> I can use the closure pattern to vend objects that do not satisfy the
> internal constraints the DOM imposes on some of its objects. No proxies in
> sight.
> So why is the method you wrote named "isDOMProxy" and whatever in the
> world does it have to do with Proxy?
> /be
> Andrea Giammarchi wrote:
>> and in both cases you would have ...
>> Proxy.isDOMProxy = function (node) {
>>   try {
>>     document.documentElement.**appendChild(node);
>>     document.documentElement.**removeChild(node);
>>     return false;
>>   } catch(gotcha) {
>>     return true;
>>   }
>> };
>> that's why I have talked about inconsistencies all over at the very
>> beginning of this thread :)
>> br
>> On Sat, Jan 12, 2013 at 10:26 AM, Nathan Wall <nathan.wall at<mailto:
>> nathan.wall at>> wrote:
>>     Nathan wrote:
>>     >
>>     > Hey Tom, I think you missed my point. The point was that in
>>     David and Boris' discussion they agreed that the DOM should throw
>>     if it is given a Proxy in `appendChild`. That sounded to me like
>>     it presumed that the DOM had a magical ability to distinguish
>>     between DOM objects and their proxies. That seemed to contradict
>>     the point David made that Proxies should not be distinguishable
>>     from their targets (e.g. the no `Proxy.isProxy` decision). If real
>>     DOM had a way to determine if something was a proxy (with a target
>>     of a *real* DOM node) and throw but there was no way for an
>>     emulated DOM (in a non-DOM environment) to determine if an object
>>     was a proxy with a target to an emulated DOM node or just a plain
>>     emulated DOM node, then the DOM has magical abilities that the
>>     emulated DOM can't have. That was my concern.
>>     >
>>     > David's reply works, though, I think. He stated that since you
>>     have to create DOM nodes using a method of the DOM itself
>>     (`document.createElement`, `document.createTextNode`), then
>>     emulated DOM could track all objects created and compare them
>>     against objects passed into `appendChild`, and since a proxy would
>>     have a different object identity from its target, the emulated DOM
>>     would have a way to distinguish proxies from their targets.
>>     >
>>     > Nathan
>>     In short, if real DOM can throw when given a proxy of a real DOM
>>     node, fake DOM should also be able to throw when given a proxy of
>>     a fake DOM node.
>>     ______________________________**_________________
>>     es-discuss mailing list
>>     es-discuss at <mailto:es-discuss at**>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list