jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

Cookies & Consents Widget: JavaScript error in the customizer in some themes

Open JohnRDOrazio opened this issue 6 years ago • 9 comments

When using the WordPress Customizer I am getting this error in the Chrome Inspector Tools:

Uncaught TypeError: Cannot read property 'classList' of null
  at eu-cookie-law.min.js:2
  at eu-cookie-law.min.js:2

It is the Jetpack eu-cookie-law because this is the full source: https://c0.wp.com/p/jetpack/8.5/_inc/build/widgets/eu-cookie-law/eu-cookie-law.min.js

The offending object is “n” which is set to “getElementById(‘eu-cookie-law’)”. I believe there should be a check for existence of the element:

if(n !== null && n.hasOwnProperty('classList'){ ... }

JohnRDOrazio avatar May 19 '20 08:05 JohnRDOrazio

Could you let me know what theme you experienced this with?

jeherve avatar May 19 '20 08:05 jeherve

Hello @jeherve it happens with any theme. I've checked on 5 different sites that I manage, each with a different theme, it happens on all of them. The error is not theme dependent. My hunch is that, since the Customizer works with an iframe, the targeted 'div' is not being found because it's inside the iframe?

JohnRDOrazio avatar May 27 '20 12:05 JohnRDOrazio

Could you give me an example of a theme from one of those sites? I can't seem to reproduce with Twenty Twenty or Twenty Nineteen, but I wonder if this may have something to do with a specific set up of widget areas.

jeherve avatar May 27 '20 12:05 jeherve

The error is occurring with these themes:

  • Di Business
  • Clean Retina
  • Maidenhair It's not occurring with "Ignite" theme.

JohnRDOrazio avatar May 28 '20 12:05 JohnRDOrazio

Thank you!

jeherve avatar May 29 '20 08:05 jeherve

Hello, greetings. I am experiencing the same error. I'm working with Engitech theme.

Wolfbel avatar Jun 09 '20 06:06 Wolfbel

Reported in 3149088-zen

interlineae avatar Jul 25 '20 12:07 interlineae

Reported in 3174888-zen

interlineae avatar Jul 27 '20 07:07 interlineae

same error reported at https://github.com/Automattic/jetpack/issues/18901 using Ahead theme

rodrigonormandia avatar Feb 22 '21 14:02 rodrigonormandia