Swap out jQuery for Cash.js #57
Replies: 2 comments 3 replies
-
I feel like most of the complaints that typically rise from the use of jQuery are usually more subjective complaints about jQuery not being fashionable; so I'm not sure cash.js would do all that much to deal with people's complaints. It might be more effective to just better document the underlying structure of the AJAX framework itself and provide a couple different implementations of framework.js in the popular libraries. |
Beta Was this translation helpful? Give feedback.
-
The file size is amazing, I'll definitely give it a try in another project. But the last update for cash.js was on Sept. 2020. Is it still maintained? jQuery got the last update to 3.6.0 on March, 3 this year. |
Beta Was this translation helpful? Give feedback.
-
This may need to wait until the Backend UI update, but thought I would put this down as an idea for future consideration.
There has been a fair bit of talk about how some people are put off by our reliance on jQuery, for two reasons:
While I don't feel that we should ditch jQuery over the first point - it provides a great interface for DOM manipulation, AJAX handling and event handling, and there's heaps of plugins out there that are likely already using it - I do agree that it's bloated for our 95% of our uses.
I have come across cash.js which provides a jQuery-compatible API but takes advantage of native syntax to bring the filesize right down (36.5kb vs 262kb uncompressed). Its focus is mainly on DOM manipulation and event handling, but it is extendable just like jQuery.
I've given it a quick run and although we'd need to extend a fair bit of functionality for our use (AJAX in particular), it does seem to work, and this could be the first step towards optimising and modernising our footprint. With AJAX, it may be worth investigating if we replace jQuery's bloated AJAX functionality with
fetch()
(with polyfills for IE11 support on the CMS side).Beta Was this translation helpful? Give feedback.
All reactions