Closed Bug 990324 Opened 10 years ago Closed 9 years ago

Optimise our jQuery build

Categories

(Marketplace Graveyard :: Code Quality, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: cvan, Assigned: kngo)

References

()

Details

(Keywords: perf)

https://marketplace-stage.cdn.mozilla.net/media/fireplace/js/include.js?b=1396040642189

Currently, jQuery accounts for 1/6 of the size of our minifed JS bundle. Let's reduce the number of things that depend on jQuery.
Keywords: perf
Blocks: 990316
No longer depends on: 990316
No longer blocks: tarako-marketplace
Blocks: 992365
Priority: -- → P2
No longer blocks: 992365
FWIW, dropping "css" from jQuery would gain us a few kilobytes after minification & gzip. 

However, that'd mean no .show()/.hide(), no .width()/.height(), and of course no .css() (and a few others). There is not that much code in fireplace using those methods, so it could be done (we are already toggling classes a lot instead of manipulating CSS directly) if we truly care... and that could even be a good step towards completely removing jQuery :-)
The nicest thing jQuery has to offer IMO is its event delegation, and the ability to bind multiple event listeners at once. Write that code as a standalone lib, and jQuery can be pretty easily removed. Oh and swap out all jQuery deferreds and use ES6 promises (using a polyfill).
I was looking at this earlier today, it seems there are a few modules we can get rid of with some elbow grease.

I started up mozilla/marketplace-jquery to host our own build through Bower. What's nice is that each frontend project can independently decide which version it wants to use, so we can focus on Fireplace.
Assignee: nobody → kngo
In today's feature-after-feature Marketplace, just going to leave it.

If in a world of a new Marketplace, we just wouldn't use jQuery at all.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.