Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293320

[meta] Replace JQuery with vanilla Javascript in core

$
0
0

Problem/Motivation

Inspired by #3051352: [Plan] Remove unused jQuery UI components and replace with a suite of contrib packages for the continuous upgrade path

jQuery used to be so awesome and It has been with us since Drupal 5.0!
IE10 was released in 2012 and supported most (all?) of the vanilla javascript that is needed to replace jQuery code.

Using vanilla javascript would allow us to remove jQuery from Drupal core as a dependency.

Proposed resolution

http://vanilla-js.com :)

The web is full of great resources for making the switch:

Remaining tasks

Relevant issues and their status as of Dec 19, 2022

Including the date here as the summaries may go out of date -- but I think it's useful to have here as we have enough tabs open already.

#3145958: [META] Re-evaluate use of Backbone.js in coreThis might be relevant to removal of jQuery, it might not. Here's why: Vue is one of the proposed replacements for Backbone. Were Vue available as a library in Core, it may significantly change the way that overall jQuery removal is approached. Some jQuery uses could be more elegantly replaced by Vue vs. a vanillaJS refactoring.
Note that that the proposed use of Vue in that issue is as a libary to benefit existing core JS, something that is dependent of the React based built-from-scratch Admin UI decision made in 2017.
#3167377: Rewrite jQuery .show() and .hide()This includes a potential approach for dealing with some of the requirements of #3179551: Provide no-library equivalents of common/useful jQuery functions
#3176423: Add classList methods polyfill for Opera Mini
#3176441: JavaScript event handling without a full jQuery dependencyThere's no simple replacement for how Drupal core uses jQuery event handling. Help us figure out how to best go about this!
#3179551: Provide no-library equivalents of common/useful jQuery functionsDetermining how to best have access to frequently-used jQuery functionality that do not have simple vanilla replacements
#3177355: Remove Tabledrag's jQuery dependency There’s a working patch for this, but it also happens to raise many implementation questions about how to go about replacing jQuery overall. Feedback is VERY welcome. Even people without tabledrag-specific interests may want to check this out as it is representative of many of the obstacles we'll run into in the no-jQuery efforts.

Patch last updated during 2022.

Postponed:

#3157328: Use vanilla JS instead of jQuery in path module Work hasn’t started on this yet, someone can hop on this. A proof-of-concept issue to see if “replace jQuery in *.module” issues will be a good approach.

Replacements

The total size of helper libraries must be lower than minified jquery which is 88kb today + 0.9kb for jquery once.

libraryreplacementsizeissue
onceVanilla JS1.3kb#2402103: Add once.js to core
eventsTBD??#3176441: JavaScript event handling without a full jQuery dependency
ajaxTBD??[#]
Total??(jquery + once: 88.9kb)

Viewing all articles
Browse latest Browse all 293320

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>