On Dec 10, 2009, at 5:09 PM, Mike Samuel wrote:
2009/12/10 Mark S. Miller <[email protected]>:
hasOwnProperty - cannot for non host objects
Incidentally, is Object.prototype.hasOwnProperty(myProxy)
O(myProxyHandler.keys().length) for proxies? This seems bad since a
for (in) loop that filters out non-own properties would be O(n**2)
on
top of the loop body.
By the current taxonomy, Object.prototype.hasOwnProperty(myProxy) is
meta-level and always returns false on a trapping proxy, revealing
that it
does not actually have any own properties.
Hmm. So a proxy of an object cannot be used as a drop-in replacement
for that object with any code that uses own property loops like
for (var k in o) if (Object.hasOwnProperty.call(o, k)) ...
?
That seems to make it less useful.
It would also make this mechanism unsuitable for building emulations
of DOM objects that have catchall properties in pure ECMAScript. Is
that a design goal for this mechanism?
Regards,
Maciej
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss