Re: [w3c/webcomponents] Returning a Proxy from a Custom Element constructor (#857)

@trusktr I used to find this (both in HTML and in regular ES) really frustrating. It took me a long time — and getting into implementation work — to really understand the “why” part of this (and relatedly, why some people say the behavior of isArray is broken rather than helpful, which used to baffle me).

I recommend really digging in if you’re curious, both because it’s a super interesting subject and because one will learn why the denial of this request and similar ones isn’t a matter of people not wanting to help us, but rather that the concept we’re after is fundamentally at odds with the “physics” of JS, like asking for 2 + 2 to equal 7.

That said, you might be interested in the fact that you can define a prototype which is a Proxy exotic object that implements `get` like this, and you could associate that prototype with new instances in your constructor. You would want your special prototype to inherit from HTMLElement.prototype in turn. I’m not sure I would recommend such an API, but it may be able to provide what you’re after.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/857#issuecomment-559918915

Received on Saturday, 30 November 2019 07:02:34 UTC