3 ms·
Just curious, does there exist a library that uses jquery syntax but with modern vanilla JS as the guts? i'm sure someone must have done this but i dont know ab
by TamDenholm 8y ago
Just curious, does there exist a library that uses jquery syntax but with modern vanilla JS as the guts? i'm sure someone must have done this but i dont know about it. I'm interested to know if you could just replace the jquery cdn link for this and have your old jquery code still work?
- topoftheforts 8y agoYes, cash.js[0] does almost that, although it doesn't mirror all of jQuery's methods (like .fadeIn() .fadeOut() for example) [0] https://github.com/kenwheeler/cash/ https://github.com/kenwheeler/cash/
- TamDenholm 8y agoThanks! This is the kind of thing i was interested to find out about.
- driverdan 8y agoWhat do you mean by jQuery syntax? jQuery has a lot of features. If you mean the query selector you can do let $ = document.querySelectorAll; If you mean chaining commands you can use the latest version of jQuery. It uses querySelectorAll under the hood.
- mattlondon 8y agoFYI I believe it is generally considered better to prefer const over let if the value is never going to change. Prevents accidentally reassigning $ here.
- driverdan 8y agoTrue. I quickly threw that out as an example.
- TamDenholm 8y agoYes i mean exactly that, but implementing as much of the jQuery library as possible, or certainly the most used parts. Was just a thought excercise.
- jrochkind1 8y agoI think maybe that _is_ JQuery.
- dsco 8y agoI’m unsure about what goes on under the hood, but Zepto uses the jQuery syntax.
- vbezhenar 8y agoLatest jQuery claims to support only recent browsers. I think it means that they are using relatively recent JS API without workaround or hacks if you're concerned about it.
- grouseway 8y agoOr perhaps more succinctly, a JS polyfill library that uses jquery as the guts. I only mean that half jokingly.
- TimTheTinker 8y agoThe latest versions of jQuery provide a jQuery API implemented on top of current web standards.
- deleted 8y ago[deleted]
- SmellyGeekBoy 8y agoYes. It's called jQuery.
- franciscop 8y agoZepto is API compatible, my own Umbrella JS (https://umbrellajs.com/ https://umbrellajs.com/) is not 100% compatible but it implements the most common jQuery methods