Skip to content

Instantly share code, notes, and snippets.

Avatar

jakub-g jakub-g

View GitHub Profile
@jakub-g
jakub-g / double-fetch-triple-fetch.md
Last active Jul 14, 2020
Will it double-fetch? Browser behavior with `module` / `nomodule` scripts
View double-fetch-triple-fetch.md

Testing double-fetching of module/nomodule JS code (including the Safari hack)

<script type="module" src="module.js"></script>
<script nomodule src="nomodule.js"></script>

TL;DR: as of April 2020 life's almost good. It should be perfect by the end of 2020 when Safari 14.0 ships and Chromium-Edge 80+ rollout finishes and Edge-Spartan dies.

Test page: https://jg-testpage.github.io/es-modules/module-nomodule/

@jakub-g
jakub-g / async-defer-module.md
Last active Jul 9, 2020
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas
View async-defer-module.md

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@jakub-g
jakub-g / 1-unicode-js-regex.md
Last active Jun 30, 2020
Unicode-aware JavaScript regex cheat sheet
View 1-unicode-js-regex.md

Unicode-aware JavaScript regex (Unicode property escapes /\p{..}\P{..}/u) cheat sheet

Browser support MDN

@jakub-g
jakub-g / _1_"script async defer" blocks "load" event.md
Last active Jun 12, 2020
Beware of "script async defer" blocking HTML "load" event
View _1_"script async defer" blocks "load" event.md

Beware of <script async defer> blocking HTML "load" event

2015.10.07 t

On the importance of simulated latency testing, and bulletproofing your page from the third-party JS load failures

TL;DR

@jakub-g
jakub-g / hn.md
Last active Jun 5, 2020
Hacker News Links
View hn.md

Hacker News "hidden" URLs

Many of HN URLs are not easily discoverable as there are no links to them in a prominent part on the page, or sometimes even nowhere. The following is a list of links to standard and "special" HN pages. The ones is bold are the less discoverable ones.

See also: https://github.com/minimaxir/hacker-news-undocumented

Posts

@jakub-g
jakub-g / README.md
Last active Jun 2, 2020
Deprecation Dailymotion postMessage API
View README.md

Context

If you landed on this page, you probably found a message like this in your logs:

This page is using deprecated Dailymotion postMessage API communication format that will be soon removed.
Please update your code. See https://gist.github.com/jakub-g/89613ccf35a98577ab9c8b9f20955eab for details.

Two possibilities

@jakub-g
jakub-g / loggers.txt
Created May 29, 2020
Filter out annoying loggers Chrome DevTools
View loggers.txt
-cookie -sourcemap -corb -cors
@jakub-g
jakub-g / _1_index.md
Last active May 16, 2020
Trójka LP3 1998 Kazik
View _1_index.md
@jakub-g
jakub-g / es2016+.md
Last active May 14, 2020
UC browser vs Chromium: Kangax ES2016+ tests
You can’t perform that action at this time.