Open wojtekmaj opened 7 years ago
My vote is on vanilla JS.. although I am partial to jQuery when handling large sets of elements.
I would also like to eventually get rid of jQuery, but there are a few things:
Element.closest()
, Element.matches()
are not supported by Safari or Edge, so we somewhat need jQuery (unless there's a good polyfill?)if
for each one or a bunch of &&
$('<div>', { id: 'foo', class: 'bar' })
IMO it's a bit nicer to use jQueryBut for new code definitely use vanilla JS, unless you're creating elements then use whatever you think is cleaner.
Hmmm... Not that I'm all against jQuery, I agree it could be useful in lots of places... In others though, it's needless. For the sake of this reply let's assume we'd like to get rid of jQuery...
That all makes sense.
Looking on the code I can see a mix of vanilla JS and jQuery (e.g.
element.classList.toggle('className')
vs${element).toggleClass('className')
). I guess this inconsistency is not something we'd like to have, so I'd like to know which way would you guys like to go?