I like your idea of determining whether custom elements have custom events by inspecting the code.

To address the challenges from the bug, I wonder if what we need to do converse: use this to determine when to use the `onFoo` syntax on an xtag and additionally track which events are defined in Element so we use `onFoo` for those as well. Today we track setters on every element in the file `html5_setters.g.dart`, we could probably generate also a list of known events for this purpose.