Active
Project:
COOKiES Consent Management
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
25 Jul 2021 at 11:37 UTC
Updated:
12 Dec 2022 at 11:24 UTC
Jump to comment: Most recent
Currently, the COOKiES library is depending on jQuery.
Drupal core and many contrib modules are moving away from jQuery to vanilla JS. See: #3052002: [meta] Replace JQuery with vanilla Javascript in core
What are your plans regarding jQuery in this module?
Ideally, we won't need jQuery any more but I guess, the reality might be a bit more complicated than that. :)
So, I suppose, things to consider are:
TBD.
- [] Remove jQuery
- [] Use ES6
- [] Optimize JS (esLint)
TBD.
TBD.
TBD.
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
anybodyThank you @design.er for raising this discussion. Good point!
Let's see what @JFeltkamp says, I'll also have a look at this if I can help.
Comment #3
jfeltkampOf course a good point. We should remove jQuery and continue with pure JS.
Comment #4
design.er commentedThat sounds great!
Some initial thoughts and questions ...
Versioning
Would it make sense to ship a COOKiES version 2.0 with vanilla JS?
That way depending COOKiES sub modules and users could keep using version 1 if they have custom jQuery-based COOKiES code on their sites and upgrade to version 2 when they're ready to ditch the jQuery dependency.
Version 2 would receive new features. The question is, (for how long) would version 1 still receive security fixes or be dropped all together?
Would version 2 be an opportunity to introduce additional (api, functional, visual) features and changes?
How complex would be an upgrade path from version 1 to 2.
Modal dialog
Drupal core is planning to replace the jQuery UI modal dialog with another technology. #2158943: Add a native dialog element to deprecate the jQuery UI dialog
Wouldn't it be great if it were possible to use the new core modal for COOKiES 2 to off-load COOKiES' development time? Maybe it's a good idea to get in touch with the responsible core maintainers in the linked issue and ask some critical questions?
If all of this is way to complicated, forget everything I just said. :)
I'm excited to read YOUR thoughts and ideas. :)
Comment #5
jfeltkampI think we don't have to release a new major version.
Users can use jQuery as long they want to.
We just have to care about this: If they don't use jquery, jquery shouldn't come in as a dependency of COOKiES.
Nice to hear that dialog soon will work without jQuery UI. It is real heavy. I didn't use it for long time because it's loading so much JS.
But the dialog loads and displays Drupal content (nodes or other pages). Unfortunately, that doesn't help us.
Comment #6
design.er commentedThat's great!
What a bummer. I was hoping it's possible to load custom (COOKiES) content in the modal dialog. It was worth a shot. :)
Are there any 3rd party COOKiES modules that require jQuery? If so, it would probably make sense to inform those module maintainers about the transition so that they can catch up?
Comment #7
anybodyAgreed with @JFeltkamp in #5. Cookies brings its own "modal" which is not a real modal and for god's sake not a horrible Drupal Core Modal ;)
Removing jQuery as dependency from COOKiES sooner or later makes sense. I created an issue fork for that. Feel free to start coding and testing.
Comment #8
anybodyNo I don't think so yet. Only eTracker and it removed jQuery itself in an issue. Could you create a MR @design.er?
Comment #9
anybodyLet's plan this for 2.x with vue!
Comment #10
anybodyJavaScript can be optimized in many parts, for example the for loops like here in core: https://git.drupalcode.org/project/drupal/-/commit/f1e33ca3d84ac2251aed1...
But I hope esLint will help a lot! :)
Comment #11
anybodyComment #12
anybodyFixing wrong status
Comment #13
anybodyHey ho, let's go! 2.x branch was recently created. Please help to implement this or if you're not a developer, please sponsor some development hours.
Comment #14
anybody