Skip to content

EventTarget

Generated from idl/dom.webidl when the site was built at 7aa23e2.

EventTarget is an interface in idl/dom.webidl, exposed in Window, Worker. What it does is on MDN; this page says what niso has of it.

The web features its members belong to, each with its Baseline status on the web and how much of the feature’s WPT suite passes in niso (see Web platform support).

Feature On the web In niso Members
Events Widely available Partial 66% 669 of 1009 subtests pass 5
constructor
constructor();
int32_t niso_event_target_new(niso_dom* dom, niso_handle* out);
operation
undefined addEventListener(DOMString type, EventListener? callback, [NisoBooleanIs=capture] optional AddEventListenerOptions options = {});
int32_t niso_event_target_add_event_listener(niso_dom* dom, niso_handle self, const char* type, size_t type_len, niso_event_listener_fn callback_fn, void* callback_userdata, niso_drop_fn callback_drop, const niso_add_event_listener_options* options);
operation
undefined removeEventListener(DOMString type, EventListener? callback, [NisoBooleanIs=capture] optional EventListenerOptions options = {});
int32_t niso_event_target_remove_event_listener(niso_dom* dom, niso_handle self, const char* type, size_t type_len, niso_event_listener_fn callback_fn, void* callback_userdata, niso_drop_fn callback_drop, const niso_event_listener_options* options);
operation
[NisoReentrant] boolean dispatchEvent(Event event);
int32_t niso_event_target_dispatch_event(niso_dom* dom, niso_handle self, niso_handle event, bool* out);
operation not in JS
[NisoInternal, NisoReentrant] EventHandler getEventHandler(DOMString type);
int32_t niso_event_target_get_event_handler(niso_dom* dom, niso_handle self, const char* type, size_t type_len, void** out);

For the event targets the binding implements (FileReader): their event handler IDL attributes, and firing trusted events at them.

operation not in JS
[NisoInternal] undefined setEventHandler(DOMString type, EventHandler handler);
int32_t niso_event_target_set_event_handler(niso_dom* dom, niso_handle self, const char* type, size_t type_len, niso_event_handler_non_null_fn handler_fn, void* handler_userdata, niso_drop_fn handler_drop);
operation not in JS
[NisoInternal, NisoReentrant] boolean dispatchTrusted(Event event);
int32_t niso_event_target_dispatch_trusted(niso_dom* dom, niso_handle self, niso_handle event, bool* out);
operation not in JS
[NisoInternal] boolean hasListeners();
int32_t niso_event_target_has_listeners(niso_dom* dom, niso_handle self, bool* out);

Whether any event listener or handler is registered, as XMLHttpRequest’s upload listener flag asks.

Members the web has, by the BCD keys web-features 3.45.0 lists, that idl/ doesn’t declare. The list is partial: web-features lists only the keys it maps to a feature.

  • when (Observable)