Closed Bug 612980 Opened 14 years ago Closed 9 years ago

Make Node inherit from EventTarget

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: heycam, Unassigned)

References

(Depends on 1 open bug)

Details

We should experiment with making Node (and other interfaces that implement EventTarget) extend from EventTarget rather than mixing it in.  As perhaps the most popular mixed in interface, it would be helpful for authors to be able to get at the single, canonical property that defines addEventListener, etc.
To make it clear: the goal here is to get specs updated to make EventTarget be the root of Node as well as other interfaces.

The following interfaces should also inherit EventTarget:

Window
XMLHttpRequest
Worker (also SharedWorker in spec, we don't implement this interface yet)
FileReader
IDBDatabase
IDBTransaction
IDBRequest
WebSocket
EventSource (in patch, not yet landed)

There's probably more that I'm forgetting.
Yes! This is exactly what I want.
WebIDL had(has?) something else for some time, and I was going to complain about 
it.

EventTarget should be the one XHR and Node and Window etc inherit.
(Internally nsINode, nsGlobalWindow, XHR, etc inherit nsPIDOMEventTarget)
(In reply to comment #1)
> There's probably more that I'm forgetting.

In other words nsINode, Window, whatever inherits nsDOMEventTargetHelper
and Worker's global.
Olli, is it too late to change this in DOM 3 Events (realising of course that it is not written in Web IDL, though)?
I don't see how this has anything to do with DOM 3 Events.
Er yeah, my mistake, it's an issue for DOM Core etc.
Depends on: ParisBindings
I believe this is done now, yes?  Anything left to do here?
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.