title: JavaScript déclaratif

> When JavaScript is used to handle user interactions like clicks, or enhance the page by manipulating the DOM, traditionally you’d have JavaScript find that HTML element in your page, and hook some code into it. But what if you’d switch that around, and have the HTML element “tell” JavaScript what function to execute?
> 
> <cite>*[Progressive enhancement with handlers and enhancers](https://hiddedevries.nl/en/blog/2015-04-03-progressive-enhancement-with-handlers-and-enhancers)* ([cache](/david/cache/ba6ef65c13ffa3b92e95fb486cfc6fe0/))</cite>

Je trouve cette approche intéressante, au moins conceptuellement. Il faudrait que je l’essaye ici pour mettre en place [Layzr.js](http://callmecavs.github.io/layzr.js/) et voir quels effets de bord cela produit.