I have an app (ObjJob) that shows the interplay of JavaScript bindings for various web-related standards. I just noticed today that HTML elements like HTMLButtonElement don’t include addEventListener() as an available method. I assumed that I had made a mistake during data import, but I can’t find it.
-
The DOM 2 HTML IDL only shows
HTMLElementinheriting fromdom::Element. -
The DOM 2 Core IDL does not include the text “event” anywhere.
-
The DOM 2 Events IDL defines the
EventTargetinterface but never binds it todom::Element.
The SVG 1.1 specs properly apply EventTarget to SVGElementInstance, but I can’t find any similar binding for HTML or DOM.
Am I crazy, or is there no official spec that associates events with DOM elements? If there is a normative reference, where is it?
Section 1.3.1 of the DOM2 Events page states that all DOM
Nodesshould implement the Event Target Interface, which includesaddEventListeneras a method.So, I think you’ve run into a bug in the browser.