A few months ago I posted Recovering From jQuery about learning Vanilla JavaScript. I have been working on that, but found some of the code a little cumbersome to try to refactor.
I ended up creating a little collection of helpers to simplify the code. Most of these will act as direct replacements for jQuery. Typically all that will be required is changing $()
to $q()
.
This is not a total replacement for jQuery. However, it was enough to get rid of 95% of my jQuery dependence. I honestly prefer addClass()
to classList.add()
.
js-query on GitHub
There are a lot of jQuery methods I could add (and probably will), but these are the bulk of what was being used in the project I'm working on now.
Please don't rake me over the coals too bad for the ajax()
function, remember, I was trying to replace $.ajax()
.
jQuery is not as evil as everybody thinks. It has some neat methods like "parentsUntil" IIRC. Also it has ajax built in which a lot of modern frameworks do not. Furthermore it is required by Bootstrap up until version 3. I've actually tinkered with adding reactivity to jQuery, though it's been over 2 years. Have other things on my plate right now, though I'm actually in contention for a jQuery role.