Remove reliance on jQuery

Created on 8 April 2022, over 2 years ago
Updated 24 March 2023, almost 2 years ago

Problem/Motivation

Drupal core is working to #1541860: Reduce dependency on jQuery .

This is why -

  • jQuery is big: 32kb of javascript that you have to load on every page that has any javascript added with drupal_add_js().
  • jQuery takes a long time to load and execute on mobile, not having that would greatly help front-end performance (we're talking about at least 200ms on mobile).
  • It is not possible to use Drupal without jQuery. The only way to do that is rewrite all core JS you're using.
  • Not using jQuery will lead to more javascript code in core. This overhead will be much smaller than jQuery's 32kb.
  • jQuery drains the battery life of a mobile phone much more than targeted javascript: http://www2012.wwwconference.org/proceedings/proceedings/p41.pdf

    Using Javascript libraries simplifies web development, but increases the energy used by the resulting pages.

    shrinking Javascript on a mobile page to contain only functions used by the page greatly reduces energy use.

The Maxlength module largely uses jQuery. That could be rewritten as vanilla JavaScript. It can also make use of CKeditor's API for Wordcount and Character Count.

Proposed resolution

Rewrite jQuery code into vanilla JavaScript.

Remaining tasks

  1. Plan rewrite approach.
  2. Rewrite the code.
  3. Test
  4. Ship

User interface changes

None

API changes

Use CKEditor 5 API.

Data model changes

TBD

📌 Task
Status

Active

Version

2.1

Component

Code

Created by

🇺🇸United States cedewey Denver, CO

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