3 ms·
> First of all, a script tag will block DOM construction, but in any sane modern browser will not block loading of subresources like stylesheets, because browse
by gsnedders 11y ago
> First of all, a script tag will block DOM construction, but in any sane modern browser will not block loading of subresources like stylesheets, because browsers speculatively parse the HTML and kick off those loads even while they're waiting for the script.
And some don't just preload resources from the speculative parsing—unless invalidated, the speculative parse is the tokenizer stage (into things like start tags, end tags, comments, characters, etc.) of the parser, and they're fed directly into the DOM construction once unblocked.
> > This isn't even that much JavaScript in web terms - 37kb gzipped.
> Just send less script. A lot less. The less script you're sending, the less likely it is that your script is doing something dumb to make things slow.
This. Seriously this. The amount of bloat in JS is insane—it's almost always the case that a lot less could be sent without any loss of functionality nowadays, and that's really, really sad.