w3ctag / polyfills

Finding on polyfills
https://w3ctag.github.io/polyfills
18 stars 6 forks source link

Encourage script@defer #12

Closed DavidBruant closed 7 years ago

DavidBruant commented 7 years ago

Authors should ship polyfills in a way that it can be loaded with the defer attribute.

triblondon commented 7 years ago

Hm. All script should be loaded async, but is there a reason to specifically address that in this finding?

DavidBruant commented 7 years ago

All script should be loaded async

How so? Or rather, I agree if you mean "async" in general, disagree if you mean with the async attribute. With the defer attribute, the loading is asynchronous, parsing too (even in a different thread in IE), but execution waits until the DOM is complete (but before firing DOMContentLoaded). @async doesn't guarantee script order (unlike @defer) and I really hope the polyfills load before my website code.

triblondon commented 7 years ago

Agree with all of that, but I think it's out of scope for the finding. Will double check with the group at the F2F next week.

triblondon commented 7 years ago

Picked up on TAG call. Alex: Should advocate following web perf best practices, no need to itemise them, that'll rot very quickly.

Action on me to find appropriate resource for web perf best practice and reference it.

triblondon commented 7 years ago

Picked up at TAG F2F. We don't have a good suggestion for a long-lived, community editable resource on web perf best practices. @DavidBruant do you have any recommendations? If not, I think we can just say 'follow web perf best practices' without linking to a reference.

triblondon commented 7 years ago

Going to close this since TAG is approving the finding in its current form, but if you have a reference suggestion I can amend later.