DEV Community

Discussion on: Hating jQuery doesn't make you cool

leastbad profile image
leastbad • Edited on

While I am very happy about my conversion to Stimulus - which is actually by the creator of Prototype, which inspired jQuery - I am regularly frustrated by how some things that are easy in jQuery are still difficult and wildly non-standard in vanilla JS.

One of the best examples is the .parents() method, which returns an array of the ancestor chain. It's not even mentioned on You Might Not Need jQuery.

I have legitimate beef with jQuery's fake event system, and even wrote a Stimulus controller to map them to real events.

However, the main reason I had to move beyond jQuery is that it is stuck in the 1:1 page load/screen world that made sense when it came out, but not in an era when people use Turbolinks and other tools to make things fast. One load event just doesn't work in 2020 and that's why so many jQuery plugins are just broken, now. I wrote about this issue extensively, if you're interested.

Stimulus is a really warm pool to get into. If you love working with jQuery, Stimulus provides lifecycle events but otherwise lets you do your thing. You can even use jQuery inside Stimulus, but I suggest you just bite the bullet.

tylerlwsmith profile image
Tyler Smith Author

I've looked at Stimulus before, but I haven't had a good use case to try it out yet. Maybe someday when I do a Rails project!

I like Turbolinks a lot. What a silly and wonderful idea that was.

leastbad profile image

Right on. Please let me know if you have any questions.

In the meantime, it does seem important to stress that Stimulus is not a Rails thing, at all.