diff options
author | Jasper Ras <jras@hostnet.nl> | 2025-05-06 23:09:23 +0200 |
---|---|---|
committer | Jasper Ras <jras@hostnet.nl> | 2025-05-06 23:09:23 +0200 |
commit | 78211f96953bc1a63570f2430cee4ad92c841ce4 (patch) | |
tree | 614db0456636442c7ef250f106f9f8b1d04e01e6 /Script elements.md | |
parent | bb5c734d7445097e94c4a602f5ce066a836dbead (diff) |
vault backup: 2025-05-06 23:09:23
Diffstat (limited to 'Script elements.md')
-rw-r--r-- | Script elements.md | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Script elements.md b/Script elements.md new file mode 100644 index 0000000..e220be5 --- /dev/null +++ b/Script elements.md @@ -0,0 +1,15 @@ +--- +tags: + - html + - web +--- +Default type: javascript. Can specify `type` with a mimetype of alternate script language. `type="module"` for javascript modules. + +Place scripts at the end rather than at the start, unless [DOMContentLoadedEvent](https://developer.mozilla.org/docs/Web/API/Document/DOMContentLoaded_event) is used. +- Javascript can't reference elements that don't yet exist +- Browser blocks rendering, and halts downloads etc until js finishes execution + +`<script defer>` dont block while downloading, execute js after rendering +`<script async>` dont block while downloading, execute js when download finished, pausing renderer until js completes + + |