-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
| /** | |
| * Async and defer simply do not work on inline scripts. It won’t do any harm, | |
| * but it’s useful to know about. | |
| */ | |
| head script:not([src])[async], | |
| head script:not([src])[defer] { | |
| border-style: var(--ct-is-problematic); | |
| border-color: var(--ct-warn); | |
| } | |
| head script:not([src])[async]::before { | |
| content: "The async attribute is redundant on inline scripts" | |
| } | |
| head script:not([src])[defer]::before { | |
| content: "The defer attribute is redundant on inline scripts" | |
| } |
Async and defer simply do not work on inline scripts. It won’t do any harm, but it’s useful to know about.
This is true for classic scripts, but type=module inline scripts can usefully have async applied:
<script type=module>
// I run like `defer`!
</script>
<script type=module async>
// I run as soon as encountered but non-blocking!
</script>defer is still useless, as it is redundant.
cweekly and mikedev64
Metadata
Metadata
Assignees
Labels
No labels