It just crossed my mind that it would be extremly nice to be able to apply javascript code like you can apply css.
Imagine something like:
/* app.jss */
div.closeable : click {
this.remove();
}
table.highlightable td : hover {
previewPane.showDetailsFor(this);
}
form.protectform : submit { }
links.facebox : click {}
form.remote : submit {
postItUsingAjax()... }
I'm sure there are better examples.
You can do pretty similar stuff with on dom:loadad -> $$(foo.bar).onClick (but this will only work for elements present at dom:loadad) ... etc. But having a jss file would be really cool.
Well, this has to be a question, not a braindump... so my question is: is there something like that?
Appendum
I know Jquery and prototype allow to do similar things with $$ and convenient helpers to catch events. But what I sometimes dislike about this variant is that the handler only gets installed onto elements which have been present when the site first got loaded.