First off, it is considered bad practice by "the community" -- the collective intelligence of average JavaScript developers.
Bad practice, by definition, is not something that's a rule that's decided by anybody, just like you can be bad at naming functions or have too long functions or using global variables all over the place, you can have your JavaScript event handlers assigned in HTML.
There was no poll and no W3C decision made. It's simply a result of many people's experience with them.
The main reasons, in my opinion are:
- The event handlers need to be global references, so everything
that's bad about global variables in general applies to them.
- It's not very obvious where your global function is being used
if you're only looking at the JavaScript code
- People generally prefer to keep their HTML clean of JavaScript and
leaving their event handling completely in JavaScript land.
- Keeping the event handling assignment in JavaScript makes it so
you don't have to change the markup to update your JavaScript code.
- If you have a lot of them around, it can get pretty repetitive. For example, when assigning the same event handler to every row in a table.
- You can't do all your event assignment in HTML, so you inevitably
will have some in HTML and some in JavaScript land, which makes it
feel extra messy.
However, there's a lot of dogma, and generally when there's a new way to do things the sheep herd will generally just run around in the same direction eschewing any other opinions. You'll hear a lot of people saying it's bad without them necessarily knowing why it's bad or knowing how to explain why they're bad.
So, being completely pragmatic about it, if you have a simple application and you just need to assign a single event handler, etc., it's your choice.
So IMO there's nothing wrong with it, and if you and the people you're working with like doing it that way, by all means, go ahead.
But yes, it's considered bad practice by the average JavaScript developer. With no authority.