Re: The JavaScript context of a custom element

2013-05-22 Thread Blake Kaplan
On Mon, May 20, 2013 at 1:00 PM, Aaron Boodman  wrote:
> 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?

There definitely has been! There was a long debate about this starting
at 
where the conclusion was to punt on the isolated mode until a later
version of the spec.
--
Blake Kaplan



Re: The JavaScript context of a custom element

2013-05-20 Thread Scott Miles
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
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  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
>>
>
>


Re: The JavaScript context of a custom element

2013-05-20 Thread John J Barton
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  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
>


The JavaScript context of a custom element

2013-05-20 Thread Aaron Boodman
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