Hey Jason;
* what are the JS optimization sub-options and exclusions?
* when JavaScript optimization is active, what JS errors do you see on the browser console?
frank
CHECKED:
* Optimize JavaScript Code?
* Aggregate JS-files?
* Also aggregate inline JS?
* Save aggregated script/css as static files?
* Minify excluded CSS and JS files?
* Enable 404 fallbacks?
* Also optimize for logged in editors/ administrators?
* Enable configuration per post/ page?
———-
EXCLUSIONS:
seal.js
js/jquery/jquery.js
js/jquery/jquery.min.js
js/jquery/jquery-migrate.js
js/jquery/jquery-migrate.min.js
wp-includes/js/jquery/jquery.js
wp-includes/js/jquery/jquery.min.js
wp-includes/js/jquery/jquery-migrate.js
wp-includes/js/jquery/jquery-migrate.min.js
———-
JAVASCRIPT ERROR IN BROWSER WHEN JS OPTIMIZATION IS ACTIVE:
“[Error] TypeError: null is not an object (evaluating ‘handle.parentNode’)
(anonymous function) (autoptimize_ba8b2166aa80db5afc67697096c5abdf.js:6:217)
Global Code (autoptimize_ba8b2166aa80db5afc67697096c5abdf.js:6:452)”
Keep in mind, however, that the JS error has always been present, even when everything was working fine last week (and for many months prior).
-
This reply was modified 2 years, 9 months ago by jasonbear.
-
This reply was modified 2 years, 9 months ago by jasonbear.
UPDATE: Adding try-catch wrapping fixes the problem, but I’ve never had that activated before. I’d really prefer not to have to use that workaround technique because—from what I’ve read—it’s essentially a hack that degrades performance by up to 90%. How can I identify the script that’s suddenly not liking AO’s optimization?
BTW, the “null is not an object (evaluating ‘handle.parentNode’)” error is now gone, as well.
-
This reply was modified 2 years, 9 months ago by jasonbear.
Morning Jason; does unticking “also aggregate inline JS” change anything (with try/catch off)?
Unticking “also aggregate inline JS” (with try/catch off) re-enables some of the JS elements, but not all. For example, my “hello bar” at the top of the page is still missing.
OK, next up; does excluding wp-content/themes
from JS optimization help?
hmm, so not divi 😉
and excluding wp-content/plugins
?
Excluding wp-content/plugins results in my missing lazy-loaded images appearing again, but with no lazy loading effect. They appear immediately, whereas previously they would “fade in” upon scrolling down the page.
Basically, all “on scroll” events are still missing.
-
This reply was modified 2 years, 9 months ago by jasonbear.
-
This reply was modified 2 years, 9 months ago by jasonbear.
-
This reply was modified 2 years, 9 months ago by jasonbear.
Confusing … :-/
Based on the JS error you mentioned, taking into account the Divi update and looking at the unoptimized HTML source, I see that Divi has inline JS that is acting on inline CSS, can you add divi-style-parent-inline-inline-css
to both the JS and CSS exclusions?
OK, I think you figured out the main conflict, which seems to involve “divi-style-parent-inline-inline-css.” 🙂
OPTION 1
Applying ONLY the JS exclusion results in:
1. full functionality;
2. JS error in Safari console.
OPTION 2
Applying ONLY the CSS exclusion results in:
1. full functionality;
2. *NO* JS error in Safari console.
OPTION 3
Applying both the CSS and JS exclusions results in:
1. full functionality;
2. *NO* JS error in Safari console.
So, it appears that Option 2 is the least intrusive way to solve the problem.
I’d love to be able to tell the Divi people which one of their specific changes in Divi 4.14.4 caused the JS to break when it had never broken across over 15 months’ worth of previous Divi updates. I can only assume that my site will be a bit slower due to things no longer being optimized in “divi-style-parent-inline-inline-css.” Do you have any idea what I should tell them?
Well, you can tell them that at least in AO’s default configuration inline CSS gets aggregated, so having JS that targets inline CSS can fail. But I doubt they’ll care much … 😉
OK, I’ll relay that information to Divi.
Thank you very much for your help, Frank! I hope that this thread will help others, too.