Re: [webcomponents]: Scope of <link rel=components>, was: Naming the Baby

I was having a conversation with someone about this topic offline.

Given the legitimacy of:

<link rel="import" href="/imports/heart.html">
<link rel="stylesheet" href="/stylesheets/style.css">

The person felt they should be able / wants to be able to:

<link rel="script" href="/js/script.js">

I didn't have a long conversation about this, just in passing. Basically
their reasoning was that they wanted a consistent syntax for importing
anything into the page that they needed, and seeing as how the syntax of
html and style imports are the same, they want to be able to load external
scripts in kind.

I explained, though, that both of these imports/links are synchronous and
blocking. If I'm reading the spec correctly then using this method to
import scripts would not have the same flexibility to use async and defer,
and loading your script this way (if it were possible) would be blocking.

Then, of course, they suggested we be able to async/defer ANY import/link.
That provoked my 'can of worms' feeling. Are there plans for anything like
async/defer for imports? It looks like in order to support this, <link>
would have to change considerably behind the scenes.

Would love to understand the non-obvious implications of these questions
and ideas.

Cheers,

- Angelina


On Wed, Apr 3, 2013 at 2:23 PM, Simon Pieters <simonp@opera.com> wrote:

> On Wed, 03 Apr 2013 09:55:33 +0200, Scott Miles <sjmiles@google.com>
> wrote:
>
>  Why don't we use <script> as the mechanism to import a component?
>>>
>>
>> One of the primary advancements of Custom Elements spec lies in the
>> ability
>> to combine HTML (templates), scoped CSS, and JavaScript into
>> encapsulations. General HTML markup is an ideal vehicle.
>>
>> Specific syntaxes are still under debate, but this is the kind of thing we
>> do using the polyfills:
>>
>> <element name='x-bundle-of-awesome'>
>>   <template>
>>     <style>
>>        /* scoped to this element */
>>     </style>
>>     <!-- Shadow DOM markup -->
>>   </template>
>>   <script>
>>
>>      // this === <element>
>>
>>      this.register({ /* controller prototype */});
>>    </script>
>> </element>
>>
>
> I don't understand how the above answers my question.
>
>
> --
> Simon Pieters
> Opera Software
>

Received on Wednesday, 3 April 2013 21:45:13 UTC