Closed snuggs closed 7 years ago
I think they are async
by default. https://bugs.chromium.org/p/chromium/issues/detail?id=523952
I think they are async by default
This comment on that thread appears to disagree.
There are definitely contexts in which async imports are not appropriate due to dependency resolutions.
@brandondees probably want to know about this comment here. Looking bleek for imports. You see this is why we can't have nice things:
async and defer have distinct behavior. DEFER means execute in order, but loading can happen concurrently. defer is pretty much always a safe option that can potentially yield performance improvement. async is not a safe universal option and shouldn't be used without consideration. according to the MDN doc i read, I believe... async is a promise to the user agent to not do anything in the script that will depend on the rest of the document state being ready. e.g. it's a "go ahead and knock this work out as early as possible because it doesn't depend on anything like dom or other scripts, but other things can depend on it"
@brandondees ok so does that mean <script async src=https://snuggsi.es>
would be standard? I've run into this race condition between the lib not being loaded and being loaded when testing it. I couldn't figure out the proper convention so just removed them all.
no it means <script defer src=https://snuggsi.es>
should be standard and adding async
should always be at the discretion of the page author
defer means "go ahead and keep parsing the document while this thing loads, but if you come to another script, put it in line after this one"
THAT is why snuggsi wasn't loading with an inline Element
definition. The lib would load way after the inline definition. Thanks @brandondees.
I think we can close this then yes?
Yep, I'd say things are cleared up. @snuggs
👍
@brandondees noticed there was an
async
attribute onHTMLLInkElement
. What would we use this for? Should all imports beasync
ed? /cc @RobertChristopher.https://w3c.github.io/webcomponents/spec/imports/#link-type-import