4 ms·
I probably should have put this caveat in the conclusion but a couple people made some version of this point so I'll put it here instead. I don't think behavio
by alexpetros 3y ago
I probably should have put this caveat in the conclusion but a couple people made some version of this point so I'll put it here instead.
I don't think behavior belongs exclusively in the HTML. There are types of webapps and complex UIs that require some form of involved state management and HTML—or, more generally, Hypertext as the Engine of Application State—is not the right solution for that. In that sense I want this post to be against the dogma of "behavior exclusively belongs in JavaScript," because I think that's incorrect and it's a pretty common view, even from expert sources that I respect.
I am, however, somewhat dogmatic in believing that web pages whose behavior can be described declaratively, in the HTML, using built-in attributes or a carefully selected superset of additional attributes, absolutely should be. This is because declarative interfaces almost always last longer and require less maintenance (I plan to write about and explore this topic in a lot more detail). A great many web pages that are not written this way could be, and suffer from an increased maintenance burden as a result.