Re: The JavaScript context of a custom element

Custom elements have a closure to work in, as well as their own prototypes.
I don't believe ES6 modules add much in this regard (possibly I'm missing
something there).

Separate global scope is a bigger issue.

I believe there was general agreement to pursue (at some point) an otp-in
'isolated' mode for custom elements, where each element would have it's own
global scope and access to a sealed version of the JS/DOM apis.

Scott


On Mon, May 20, 2013 at 1:26 PM, John J Barton
<johnjbarton@johnjbarton.com>wrote:

> Aren't ES6 modules is a good-enough solution for this issue? They make
> global collision rare and likely to be what the author really needed.
>
> jjb
>
>
> On Mon, May 20, 2013 at 1:00 PM, Aaron Boodman <aa@google.com> wrote:
>
>> Hello public-webapps,
>>
>> I have been following along with web components, and am really excited
>> about the potential.
>>
>> However, I just realized that unlike the DOM and CSS, there is no real
>> isolation for JavaScript in a custom element. In particular, the global
>> scope is shared.
>>
>> This seems really unfortunate to me, and limits the ability of element
>> authors to create robustly reusable components.
>>
>> I would like to suggest that custom elements have the ability to ask for
>> a separate global scope for their JavaScript. This would be analogous to
>> what happens today when you have multiple script-connected frames on the
>> same origin.
>>
>> Has there been any thought along these lines in the past?
>>
>> Thanks,
>>
>> - a
>>
>
>

Received on Monday, 20 May 2013 20:37:47 UTC