- In your html, you annotate objects (e.g. a button) with the '.actionable' class
- Then provide a set of arguments in the html alongside, e.g.
<div class="kwargs">
<!-- replace #money with the output from /user/3/money/create -->
<input name="type" value="replace" />
<input name="target" value="#money" />
<input name="url" value="/user/3/money/create" />
</div>
- The library then parses the html of .actionable objects, and automatically creates the relevant jQuery bindings for you. In other words, you define the behavior in html, without having to write any custom javascript.We're experimenting with a few ways of extending this on Memrise (Spencer Davis gets most of the credit here). It's early days, but we're an ajax-heavy site, and devolving certain kinds of basic, repetitive functionality to html feels natural and simple. And, by adding new handler types to the library, it becomes much, much easier to create reusable widgets that we can sprinkle throughout the site.
P.S. Currently, most of this work is still on a development branch that will be live within a couple of days.