- Issue created by @solarDog
- 🇮🇳India mukhtarm
Hi @solarDog You have to change the cocoen_beforeafter.js to
(function ($, Drupal, once) { Drupal.behaviors.beforeafter = { attach: function (context, settings) { once('.cocoen-beforeafter-container', context).cocoen(); } } })(jQuery, Drupal, once);
As well as point the
core/once
library incocoen_beforeafter.libraries.yml
(Which will remove the once error for you). I will provide a patch soon.
Asjquery.once
is deprecated in favour ofcore/once
as you said. - 🇺🇸United States solarDog
Thank you @mukhtarm. I am not having any luck getting this working. I do not have cocoen_beforeafter.js in my library. Only cocoen-jquery.min.js and cocoen.min.js exist in /cocoen/dist/js/
Can you confirm which library version I should be using?
- First commit to issue fork.
- Merge request !1Issue #3399344: Replaced jquery.once with core/once library. → (Merged) created by ankithashetty
- Status changed to Needs review
12 months ago 9:19am 28 November 2023 - 🇮🇳India ankithashetty Karnataka, India
Raised an MR with the necessary changes and ready for review.
Could @solarDog please test the changes in MR and see if it works?Thanks!
-
ankithashetty →
committed d0a56a0b on 8.x-1.x
Issue #3399344: Replaced jquery.once with core/once library.
-
ankithashetty →
committed d0a56a0b on 8.x-1.x
- Status changed to Fixed
11 months ago 12:04pm 11 January 2024 Automatically closed - issue fixed for 2 weeks with no activity.
- 🇺🇸United States solarDog
I am still getting the same error. You may inspect the page here: https://pthomeservices.com/projects/cedar-faerie-tree-palace
I am using cocoen v2.0 with 8.x-1.2. and Drupal 10.2.2 .
Maybe I am missing a simple step here? - 🇨🇦Canada jmoruzi Brantford, ON
I'm getting the same error, "Uncaught TypeError: $(...).once is not a function" with the latest version and D10.2.4.
Can you clarify the suggestion above where you say "As well as point the core/once library in cocoen_beforeafter.libraries.yml" please. What do I need to change/add in the libraries file?
The previous version of this module worked great on D9 and I'd like to keep it in D10 but right now it's not working.
Thanks.