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