Interface IEventTarget
- Namespace
- AngleSharp.Dom
- Assembly
- AngleSharp.dll
EventTarget is a DOM interface implemented by objects that can receive DOM events and have listeners for them.
[DomName("EventTarget")]
public interface IEventTarget
- Extension Methods
Methods
AddEventListener(string, DomEventHandler?, bool)
Register an event handler of a specific event type on the EventTarget.
[DomName("addEventListener")]
void AddEventListener(string type, DomEventHandler? callback = null, bool capture = false)
Parameters
type
stringA string representing the event type to listen for.
callback
DomEventHandlerThe listener parameter indicates the EventListener function to be added.
capture
boolTrue indicates that the user wishes to initiate capture. After initiating capture, all events of the specified type will be dispatched to the registered listener before being dispatched to any EventTarget beneath it in the DOM tree. Events which are bubbling upward through the tree will not trigger a listener designated to use capture.
Dispatch(Event)
Dispatch an event to this EventTarget.
[DomName("dispatchEvent")]
bool Dispatch(Event ev)
Parameters
ev
EventThe event to dispatch.
Returns
- bool
False if at least one of the event handlers, which handled this event called preventDefault(). Otherwise true.
InvokeEventListener(Event)
Calls the listener registered for the given event.
void InvokeEventListener(Event ev)
Parameters
ev
EventThe event that asks for the listeners.
RemoveEventListener(string, DomEventHandler?, bool)
Removes an event listener from the EventTarget.
[DomName("removeEventListener")]
void RemoveEventListener(string type, DomEventHandler? callback = null, bool capture = false)
Parameters
type
stringA string representing the event type being removed.
callback
DomEventHandlerThe listener parameter indicates the EventListener function to be removed.
capture
boolSpecifies whether the EventListener being removed was registered as a capturing listener or not.