Sauter la navigation

[Résolu] Bad Javascript Call

This support ticket is created Il y a 6 années et 4 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Marqué : 

Ce sujet contient 7 réponses, a 2 voix.

Dernière mise à jour par zacharyL Il y a 6 années et 4 mois.

Assisté par: Luo Yang.

Auteur
Publications
#1077623

I am trying to: Use any JS/CSS minification plugin to bring our page load times down

Link to a page where the issue can be seen: Home page

I expected to see: No JS errors

Instead, I got: wptValidationForms.push("#cred_form_..."); throws an error because it's naively called without waiting for the wptValidationForms object to be available. Currently Toolset loads a TON of scripts and assets and it's killing our page loads and our clients are getting angry with us. We "have" to use a minifier/concatination tool to fix this, but we can't get this item that's called as soon as it's rendered to play nice. I see that it's called in many of the Toolset plugins.

If I wait until after the page loads and call it manually, it works fine: lien caché

Can you please help? Thanks!

#1078288

Hello,

I assume we are talking about a compatibility problem with the "minifier/concatination tool".

If it is, please provide a downloadable URL for the "minifier/concatination tool", and describe detail steps to duplicate the same problem.

I need to duplicate and debug it in my localhost, thanks

#1079452
bad-js.JPG

I have tried the "Fast Velocity Minify" plugin, download from
https://wordpress.org/plugins/fast-velocity-minify/
with the latest version of Toolset plugins in a fresh wordpress installation + 2017 theme

Here is the detail steps, please correct me if there is anything missing:
1) Dashboard-> Settings->Fast Velocity Minify-> Settings
Setup the settings a according to your screenshot:
https://toolset.com/wp-content/uploads/2018/08/1078592-screenshot_10.png

2) Create a Toolset post form with reCAPTCHA field

3) Test it in front-end, it works fine, I don't see the JS error as your screenshot
lien caché

See my screenshot bad-js.JPG

Is there any missing steps?

And since it is a compatibility problem, according to our support policy, for such kind of compatibility problem conduct by third-part plugin, you can also check it with the author of "Fast Velocity Minify" plugin:
https://toolset.com/toolset-support-policy/

#1080281

We are using the latest Divi theme, which is officially supported by you guys. Can you test with Divi for starters and let me know if the error is still not showing?

P.S. This is a "HUGE" issue for us because not being able to minify (with any plugin) without major breakage due to complexity of Toolset & Divi is pushing our page speed scores down so much it's impacting our SEO ranking, page load times, and customer satisfaction. I'm willing to dig for stuff for you guys to help the process along, but ultimately, it's you're product and what I'm seeing is that line of code is naively executing javascript without waiting for the page to be loaded or a specific object to be available, which is generally bad practice as it is.

Let me know what I can do to help, but it definitely has to be solved because we have Toolset running all of our websites and can't migrate away from it at this point.

Thanks for your understanding.

P.S. Toolset loads an enormous number of assets on each page load. Am I the only one who thinks this is pretty extreme? As a web software developer, I understand how that can easily happen, but I will say that between Divi & mostly Toolset, our number of assets is insane. I just want to figure out the best way to manage this, so any input would be helpful.

#1081027

I have tried the DIVI theme, same as above, there isn't similar problem, please provide a copy of your website, I need to duplicate the same problem and debug it in my localhost.
https://toolset.com/faq/provide-supporters-copy-site/

#1082721

Thanks for the details, I am downloading the file, will update here if there is anything found

#1082723
bad-javascript-call.JPG

Here are what I found:
1) Install the duplicator package in my localhost, I assume we are talking about the post form "Testimonial Submission"
I have tried it in front-end, and I can see the JS error as your screenshot:
"Uncaught ReferenceError: wptValidationForms is not defined"
2) Then I have tried to switch to original DIVI theme, the JS errors isn't any more

So it is a problem of your theme "Divi - weCreate Child Theme", it is in the theme file "functions.php", line 79, I have tried to replace this line from:

add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );

To:

//add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );

The problem is fixed, see screenshot bad-javascript-call.JPG.
can you confirm it in your website?

Since it is a custom codes problem, which is out the range of Tooslet support, you can also check it with our experienced contractors
https://toolset.com/contractors/

#1083229

Oh wow! I didn't realize that was still in there. That makes a lot of sense now. Thank you so much!