Replacing jQuery (110kb) With UmbrellaJS (8kb)
bennadel.com
Replacing jQuery (110kb) With UmbrellaJS (8kb)
1–10 of 55 posts
Re: Replacing jQuery (110kb) With UmbrellaJS (8kb)
#2Re: Replacing jQuery (110kb) With UmbrellaJS (8kb)
#3Cash is also a great jQuery replacement. It's slightly larger than Umbrella, but does more. It also supports partial builds to shrink it down further. https://github.com/fabiospampinato/cash
Re: Replacing jQuery (110kb) With UmbrellaJS (8kb)
#4Re: Replacing jQuery (110kb) With UmbrellaJS (8kb)
#5If you haven't keeping up with all the new script-tag parameters, I suggest looking at this: https://gist.github.com/jakub-g/385ee6b41085303a53ad92c7c8af...
Choosing type=module is usually better choice than classic script tags like in the article. Module tags fetches (if any modules is used) asynchronously, and executes after the parser, however it won't work with older browsers.
Re: Replacing jQuery (110kb) With UmbrellaJS (8kb)
#6That said, in addition to forcing me to restore a lot of fun animations that I had previously broken while porting the site from AngularJS to Angular, it also just ended up making the code a lot better. A lot of the times when we were doing something with jQuery, the same thing could have been done more cleanly using [ngClass] or whatever. So taking the three or four days to remove jQuery actually made the business logic of the site much easier to understand. Performance benefits aside, I'd definitely recommend it for this reason alone.
Re: Replacing jQuery (110kb) With UmbrellaJS (8kb)
#7I think zepto.js is a better choice. It's slightly bigger than cash but much closer to jquery (for example it has $.ajax) https://zeptojs.com
Zepto supports some methods that Cash doesn't, but you probably shouldn't use them to begin with, like $.ajax, $.isArray, $.fn.animate etc. In 2022 either better built-in solutions exist or better specialized tiny libraries exist.
Everything that is supported by both Zepto and Cash should either work identically or Cash's implementation should be closer to jQuery's. Just to mention one thing in this regard you can run jQuery's test suite with Cash, and Cash's test suite with jQuery, easily [0]. I've done so and looked at every single failed test manually a few times, I doubt nearly the same level of attention went into Zepto. Just to mention one difference: Cash supports jQuery-style event namespacing, Zepto just doesn't support this, it is implementing something that looks similar but that works differently in pretty important aspects, that's worse than not supporting obsolete methods IMO, but I guess it depends on your use case for a library like this.
[0]: https://github.com/fabiospampinato/cash/blob/272132a6dc1d885...
Re: Replacing jQuery (110kb) With UmbrellaJS (8kb)
#8Re: Replacing jQuery (110kb) With UmbrellaJS (8kb)
#9I prefer `querySelector` and bare ` ` tags for quick and dirty jQuery replacement. If you haven't keeping up with all the new script-tag parameters, I suggest looking at this: https://gist.github.com/jakub-g/385ee6b41085303a53ad92c7c8af... Choosing type=module is usually better choice than classic script tags like in the article. Module tags fetches (if any modules is used) asynchronously, and executes after the pars…
Re: Replacing jQuery (110kb) With UmbrellaJS (8kb)
#10I prefer `querySelector` and bare ` ` tags for quick and dirty jQuery replacement. If you haven't keeping up with all the new script-tag parameters, I suggest looking at this: https://gist.github.com/jakub-g/385ee6b41085303a53ad92c7c8af... Choosing type=module is usually better choice than classic script tags like in the article. Module tags fetches (if any modules is used) asynchronously, and executes after the pars…
The author mentions that enforces CORS restrictions which would break with their current server settings and CDN, otherwise I think they agree with you.