Re: [HTML Imports]: what scope to run in

On Tue, Nov 19, 2013 at 5:27 PM, John J Barton

>  (snip)

>  This isn't how node modules or ES6 modules work. A module designed for
>> use with node can define properties on the `global` (ie. the object whose
>> bound identifier is the word "global") and this is the same global object
>> making the require(...) call. ES6 modules are evaluated in the same global
>> scope from which they are imported.
> However ES6 modules do solve the list of downsides in Jonas' list. And ES6
> modules create a scope so variables and functions declared in a module but
> not exported do not pollute the global object as a side-effect of
> declaration.
> I think ES6 modules for HTML imports provide a good compromise between
> current HTML import design (no modules just packaging) and total
> iframe-like encapsulation (many practical and design issues).

Yes, completely agree that they are the best solution—as long as their
capabilities are understood and their use is specified within the bounds of
those capabilities.


Received on Tuesday, 19 November 2013 22:39:07 UTC