3 ms·
You can just assign document.QuerySelector and document.QuerySelectorAll to $ and $$ yourself.
by emodendroket 5y ago
You can just assign document.QuerySelector and document.QuerySelectorAll to $ and $$ yourself.
- claviska 5y agoYou can, and some JS consoles provide this for convenience if those vars are unused, but jQuery really shines with method chaining. That’s what I miss the most from it. You could manipulate the DOM in incredible ways in “one line” of code.
- emodendroket 5y agoDepends what you want to do, but I've kind of come around because I feel like if what I want to do is so complicated that I can't easily do it in vanilla JS, it's also complicated enough that I don't necessarily want to do it by manual DOM manipulation. Changes the calculation if you have to support older browsers and such though.
- hoten 5y agoFYI chaining and a handful of the most common operations can be implemented in just a few lines of code: https://gist.github.com/paulirish/12fb951a8b893a454b32 https://gist.github.com/paulirish/12fb951a8b893a454b32 (Although I reach for the "cash" library instead of this or jQuery when I need something jQuery like)