Maybe Steve's example[1] could be on JS rather than on components:
System.component("import.php", function(component) {
var content = component.content
document.getElementById('import-container').appendChild(content.cloneNode(true));
});
Here we mimic System.load(jsId, success, error). Then make <link> not
block <script>: it's on JS to express the dependency correctly.
jjb
On Mon, Nov 18, 2013 at 1:40 PM, Dimitri Glazkov <dglazkov@google.com>wrote:
> 'Sup yo!
>
> There was a thought-provoking post by Steve Souders [1] this weekend that
> involved HTML Imports (yay!) and document.write (boo!), which triggered a
> Twitter conversation [2], which triggered some conversations with Arv and
> Alex, which finally erupted in this email.
>
> Today, HTML Imports loading behavior is very simply defined: they act like
> stylesheets. They load asynchronously, but block <script> from executing.
> Some peeps seem to frown on that and demand moar async.
>
> I am going to claim that there are two distinct uses of <link rel=import>:
>
> 1) The import is the most important part of the document. Typically, this
> is when the import is the underlying framework that powers the app, and the
> app simply won't function without it. In this case, any more async will be
> all burden and no benefit.
>
> 2) The import is the least important of the document. This is the "+1
> button" case. The import is useful, but sure as hell doesn't need to take
> rendering engine's attention from presenting this document to the user. In
> this case, async is sorely needed.
>
> We should address both of these cases, and we don't right now -- which is
> a problem.
>
> Shoot-from-the-hip Strawman:
>
> * The default behavior stays currently specified
> * The "async" attribute on <link> makes import load asynchronously
> * Also, consider not blocking rendering when blocking <script>
>
> This strawman is intentionally full of ... straw. Please provide a better
> strawman below:
> __________________
> __________________
> __________________
>
> :DG<
>
> [1]:
> http://www.stevesouders.com/blog/2013/11/16/async-ads-with-html-imports/
> [2]: https://twitter.com/codepo8/status/401752453944590336
>