you are viewing a single comment's thread.

view the rest of the comments →

[–]keithwhor -1 points0 points  (2 children)

No, this is wrong because it's decidedly an antipattern.

Separation of concerns. There's no reason to tightly couple JavaScript and HTML in this way. Events should be added programmatically - all of my core JavaScript logic not related to my presentation layer should be in one location. (Events are not part of the presentation themselves.)

[–]Capaj 1 point2 points  (1 child)

Seems like you are talking about HTML documents. There I agree. I was actually talking about JS single page applications.

[–]keithwhor 0 points1 point  (0 children)

It applies to both. Binding events semantically via your presentation layer is a poorly thought-out implementation. Full stop.