-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sharing: Render Blocking Inline Javascript Injection - Dependency Deferred #6977
Comments
Alright, so the problem here is that you're deferring core scripts and are surprised that something breaks. That's not exactly a use case that we ever aimed to support. That being said, this is something that may be worth looking into supporting in the future, but it's not an immediate concern or focus for us right now. If you write a pull request, we'll certainly review it and potentially merge it, but I'm not sure we'd devote team time into rewriting it to work with changed core script functionality. |
No, I am surprised that the plugin doesn't support deferring, and rooting out render blocking at the client end. So, the basic checks need to be done before injecting potentially breaking javascript when Sooo Many people subscribe to Jetpack. As an end user of the plugin, the very least I should be able to expect, is that If I optimize my site, Jetpack integrations don't break. I'd be happy to write a patch, but Having no prior experience with wordpress development, I am not very sure If I just modify the sharedaddy file directly. As in just get in and hard code a patch? cheers. |
Also, it's worth noting that WordPress Core itself doesn't support deferring scripts either -- for good reason, considered the complexities involved. https://core.trac.wordpress.org/ticket/12009#comment:31 I can assure you that if WordPress Core supports defer in the future, we'll have a resolution in place to support it gracefully. Regarding submitting a patch -- yup! Just go in, tweak it, and we'd be delighted to review and provide feedback on your changes. It's one of the reasons I first got into Open Source -- it helped me get early reviews on my code and learn what I was doing. :) |
Also, if anyone wants to defer jQuery to test this, here's a gist that will let you do it. https://gist.github.com/georgestephanis/2a84bc55ad23f4dec2cf2464109add59 You can also add a defer attribute to any script (as the first chunk is doing) and it will add it to that script as well. |
Thanks @georgestephanis Much appreciated links to grok! |
As a general rule, if something helps edge cases such as yours, and isn't harmful or particularly large to folks in general, we'll consider it favorably for inclusion. |
Steps to reproduce the issue
You Need a website hosted.
Defer All Javascript Loads (Because, Nothing that Sharing-JS /Sharedaddy adds is of value to the end user. He will share it if He Reads it) - But Primarily because, perf matters!
Open the web console on your favourite browser and browse to the site
What I expected
No Errors
What happened instead
Look at those jQuery Dependency Failures
Issue
You are Injecting Javascript, without any prior check to see if dependencies are loaded by the browser.
If the goal is to async load an external script for sharing, Why Use a HUGE Library such as jQuery to check dom loaded?
Use the Platform instead. Event listeners for
domcontent
loaded should sufficeInside the callback, Do use jQuery to async fetch and load those externals by all means.
The text was updated successfully, but these errors were encountered: