Search code examples
javascriptdomdom-eventsw3c

Where is addEventListener specced for DOM 2 HTML?


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 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?


Solution

  • Section 1.3.1 of the DOM2 Events page states that all DOM Nodes should implement the Event Target Interface, which includes addEventListener as a method.

    So, I think you've run into a bug in the browser.