We agreed on a few things in the jQuery issue #1541860: Reduce dependency on jQuery This is the meta tracking the progress. What this aims at is a full review of our JS code.

What we agree on, in order of most important for perfs:

  1. #1279226: jQuery and Drupal JavaScript libraries and settings are output even when no JS is added to the page
  2. Look at all our selectors and HTML structure and see how that can be simplified to allow better, faster selectors.
  3. don't use sizzle-specific selectors if we can avoid it.
  4. use regular for loops when $(seletor).each() is overkill. Separate the selecting and processing of elements. Typically it means removing the anonymous function when using .once().

The plan is to open an issue for each core file/module and tackle points 2-4 one file at a time.

I've highlighted the ones that would benefit the most. The changes to tabledrag are a bit more drastic than the rest so we might to keep it for the end since it's such a big piece of code.

Feel free to edit and add links to issues. Don't forget to add the "JavaScript Clean-up" tag to every issue you might open for this.

Comments

nod_’s picture

Issue summary: View changes

separate some files

nod_’s picture

Issue summary: View changes

authorize.js

nod_’s picture

Issue tags: +mobile, +html5

Since changing some HTML to make things cleaner, adding a few tags.

nod_’s picture

Issue summary: View changes

batch.js

neclimdul’s picture

oh man... can we break at least the for loop thing into one patch. That's I and asked for this to be broken down but people(like me) aren't interested in files, we interested in conceptual changes and this makes it really hard to track. Can we open an issue for #2 and #4 in the summary to take a first pass then use the longer list to nail down smaller optimizations or things that where sticking points in the larger issue?

neclimdul’s picture

Issue summary: View changes

adjust scope

nod_’s picture

Issue summary: View changes

block

nod_’s picture

Issue summary: View changes

book, statistics

nod_’s picture

Issue summary: View changes

book

nod_’s picture

Title: Selectors clean-up » [Meta] selectors clean-up
nod_’s picture

Issue summary: View changes

timezone

nod_’s picture

Issue summary: View changes

table black-magic

nod_’s picture

Issue summary: View changes

tableheader

Jacine’s picture

Issue tags: -html5

Hey, I hope you don't mind, but in an effort to get a better picture of issues remaining in the HTML5 Initiative, we are removing the "html5" tag from issues that are not directly HTML5-related. Note: Any issues assigned to the "Markup, CSS and JavaScript" components will still be broadcast on the HTML5 Twitter feed so that interested parties are aware and can participate. Thanks! :)

klonos’s picture

sxnc’s picture

Tried to have a go at this and started with ajax.js: #1751320: Selectors clean-up: ajax.js

nod_’s picture

Priority: Major » Normal

The details patch #1168246: Freedom For Fieldsets! Long Live The DETAILS. clean-up a lot of bad selectors, demoting.

nod_’s picture

Issue summary: View changes

simplify summary

LewisNyman’s picture

Issue summary: View changes
Issue tags: +frontend
Manuel Garcia’s picture

Manuel Garcia’s picture

Added this issue as parent to all it's children issues I could find.

Manuel Garcia’s picture

xjm’s picture

Coming here from #1751436: Selectors clean-up: bartik/color theme. So code cleanup for its own sake generally is no longer in scope during the beta; however, it sounds like this has the potential to improve frontend performance. Can we add a beta evaluation that explains the performance improvement a bit more? Thanks!

xjm’s picture

Issue tags: +Needs beta evaluation
nod_’s picture

Title: [Meta] selectors clean-up » Selectors clean-up
Category: Task » Plan
andriyun’s picture

Issue summary: View changes

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’s picture

Version: 8.2.x-dev » 8.3.x-dev

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.