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

Issue summary:View changes

separate some files

Issue summary:View changes

authorize.js

Issue tags:+mobile, +html5

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

Issue summary:View changes

batch.js

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?

Issue summary:View changes

adjust scope

Issue summary:View changes

block

Issue summary:View changes

book, statistics

Issue summary:View changes

book

Title:Selectors clean-up[Meta] selectors clean-up

Issue summary:View changes

timezone

Issue summary:View changes

table black-magic

Issue summary:View changes

tableheader

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! :)

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

Priority:Major» Normal

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

Issue summary:View changes

simplify summary