Re: [components] Isolated Imports and Foreign Custom Elements

> On May 1, 2015, at 9:47 AM, Anne van Kesteren <annevk@annevk.nl> wrote:
> 
> On Thu, Apr 23, 2015 at 8:58 PM, Maciej Stachowiak <mjs@apple.com> wrote:
>> I wrote up a proposal (with input and advice from Ryosuke Niwa) on a
>> possible way to extend Web Components to support fully isolated components:
>> 
>> https://github.com/w3c/webcomponents/wiki/Isolated-Imports-Proposal
>> 
>> I welcome comments on whether this approach makes sense.
> 
> I don't get the bit where you create a node in one global, but run its
> constructor in another.

It’s already possible to run a constructor from another global object in the non-cross-origin case. Simple example below (it uses a built-in type as the example, but it could work just as easily with a custom defined prototype-based constructor or ES6 class constructor).

<iframe id="frame">
</iframe>
<script>
function doIt() {
    window.ForeignArray = document.getElementById("frame").contentWindow.Array;
    var localArray = new Array();
    var weirdArray = new ForeignArray();
    alert(weirdArray.__proto__ == localArray.__proto__);
}

window.addEventListener("load", doIt);
</script>

My proposal suggest something similar, except everything is wrapped with translating proxies at the origin boundary.

I think it may be necessary to do an experimental implementation to work out all the details of how the two-way isolation works.

> That seems rather Frankenstein-esque. Would
> love to see more details overall, as the direction this is going in
> certainly seems like the kind of thing we want. Allowing a dozen
> Facebook Like buttons to appear on a page using only one additional
> global.

Yes, that’s the goal.

Regards,
Maciej

Received on Friday, 1 May 2015 22:47:36 UTC