jQuery supports custom builds. The latest beta version supports removing the ready event, Sizzle selector and many other features.
Core JS should be able to run on a stripped down version of jQuery to allow knowledgable developer to build fast frontends more easily. I would like to ship jQuery with the ready event removed altogether to force contrib to use Drupal.behaviors, I've seen way to many jQuery.ready() during my audits to count.
What I'm proposing:
Run core JS with this jQuery build: grunt custom:-core/ready,-sizzle,-deprecated,-effects,-event/alias,-wrap,-ajax/jsonp
Ship Drupal with that one: grunt custom:-core/ready
For info the size of unminified and minified for the different versions:
| build | original | minified | min+gz |
|---|---|---|---|
| Normal | 245207 | 83820 | 29363 |
| -core/ready | 242970 | 83203 | 29159 |
| -core/ready,-sizzle,-deprecated,-effects, -event/alias,-wrap,-ajax/jsonp |
165640 | 56816 | 20105 |
Comments
Comment #1
nod_Comment #2
nod_Comment #3
nod_Comment #4
ibnkhaldun commentedI read your post "Reduce dependency on jQuery" and almost all the comments on. So came here. While reading I ask my self: why not an scalable version of jquery? Is it possible? as Dojo is. I think It should be a good solution to load on demand the needed subset of objects. Perhaps better than truncate nice functions we all use everywhere.
Comment #5
nod_You're right, which is why I started working on this a while back (need to get back to it though): https://www.npmjs.com/package/jquarry
Comment #8
andypostComment #22
smustgrave commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #24
smustgrave commentedWith the effort to move off jquery should this be closed?