I’ve been looking over the docs at developer.mozilla.org and the Apple dev docs but I’m not able to find documentation that explains whether or not you can programatically determine if a specific HTML tag supports a given eventListener.
Like I know that the <script> tag isn’t going to support the click listener since there’s nothing to click on, but how do I know that?
Or barring that, is there an easy reference somewhere of what events each tag supports?
Outside of a few edge cases, yes you can, according to Perfection Kills:
Basically, the code looks like this:
He uses it to detect event support in various browsers, but it could also be used to detect whether or not an element supports an event:
So you also get results like this: