Johny_K
November 24, 2022, 9:04pm
1
Jquery results in:
Third-party code blocked the main thread for 590 ms
The theme is modification of Ghost Ease.
Trying different versions of Jquery and CDN-s results in different outcome.
I’ve read controversial materials on the topic.
Is it possible to use defer
/ async
for the ghost JQuery script or completely remove it?
<script
src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous">
</script>
Johny_K
November 25, 2022, 9:07pm
2
It seems that some parts of ghost are not working with jquery + defer
like: image loading.
So adding defer is not an option.
Using jquery.slim.js
seems to work fine and make 50% speed improvement over the reqular Jquery.
The above warning is resolved:
Third-party code blocked the main thread for 590 ms
Pagespeed back to 100%.
Slim version is available from: jQuery Core – All Versions | jQuery CDN
Using the slim minified.
Note : What is different in slim package:
The short answer taken from the announcement of jQuery 3.0 Final Release :
Along with the regular version of jQuery that includes the ajax and effects modules, we’re releasing a “slim” version that excludes these modules. All in all, it excludes ajax, effects, and currently deprecated code.
The file size (gzipped) is about 6k smaller, 23.6k vs 30k.
Source:
jquery, slim-jquery