This is a repeat of https://www.drupal.org/project/eu_cookie_compliance/issues/3277316. This problem was supposed to be fixed but is apparently broken again. When updating the module from v1.19 to 1.21, the body class is no longer applied after the user makes their consent selection.
I think the problem still in js/eu_cookie_compliance.js. Line 26 makes reference to the containing element, so I'm not sure why there is an $.each() loop with a function argument of element. Using a console.log() statement, the value of element in the loop is 0; the value of this is the actual containing element (body by default).
If I replace $(element) with $(this) on line 66, the class is properly applied.
I don't fully understand the difference between the $.each loop beginning line 26 and the forEach loop on line 71, so I'm not sure if the same fix would work on line 108. However, the element argument in each loop appears to be only used for that class assignment.
Issue fork eu_cookie_compliance-3309240
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
aaronpinero commentedComment #3
aaronpinero commentedComment #4
svenryen commentedThanks for the report! I'll have a look.
Comment #7
svenryen commentedComment #8
svenryen commentedThanks. I can confirm you're right. The class seems to be applied correctly if we replace
elementwiththis.