Introducing jquery-events-to-dom-events (and jboo)
Did you know that jQuery events aren’t events?
It’s true - and it’ll really mess up your night if you need to capture events from legacy jQuery components. Looking at you,
I needed a way to make
$(document).trigger('fart') emit a standard
$fart DOM event, so I wrote it:
This library is short and sweet, with zero dependencies - including jQuery. It’s just two functions:
abnegate. It is Mutation-First; designed to work great in Stimulus and supports Turbolinks out of the box.
It even has the secret ability to listen for DOM events with jQuery event listeners, but don’t tell anyone.
You can try it now on CodePen or even better, clone a sample Rails project to experiment in a mutation-first context with Stimulus.
The Rails project is called jboo. Don’t read into the name.
Note: it is...
Continue reading →