JavaScript event handling without a full jQuery dependency

Created on 12 October 2020, about 4 years ago
Updated 7 November 2023, about 1 year ago

Problem/Motivation

We are looking into removing jQuery 🌱 [meta] Replace JQuery with vanilla Javascript in core Active
In comment #10 nod_ pointed out that

The other thing is that jQuery is still above native for is most event handling tasks, and does make the code simpler to understand. We'd need to make a few "helpers" to keep the same readability (and not rewrite everything), and at that point we're making our own library.

So this is the issue where that work can happen.

Steps to reproduce

We are not using event aliases like .click(), etc. It's those functions that are declared by the event module of jquery and used in Drupal.

Proposed resolution

Not sure yet

Remaining tasks

  • Determine if we can simply work with a minimal jQuery build that only has the event feature
  • Determine what functionality of jQuery event handling should remain available in Drupal's custom event "helpers", such as event namespaces and junk collection
  • Identify any additional requirements that aren't covered by the features-needed-from-jQuery list.
  • Find an implementation that makes the switch from jQuery events to vanilla as simple as possible.

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Needs work

Version

11.0 πŸ”₯

Component
JavascriptΒ  β†’

Last updated about 10 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States bnjmnm Ann Arbor, MI

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024