Class EventTarget
- Namespace
- AngleSharp.Dom
- Assembly
- AngleSharp.dll
Event target base of all DOM nodes.
public abstract class EventTarget : IEventTarget
- Inheritance
-
EventTarget
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
EventTarget()
protected EventTarget()
Methods
AddEventListener(string, DomEventHandler?, bool)
Register an event handler of a specific event type on the Node.
public 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 Node 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 Node.
public 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.
HasEventListener(string)
Checks if the given event type has any listeners registered.
public bool HasEventListener(string type)
Parameters
type
stringThe name of the event.
Returns
- bool
True if listeners are registered, otherwise false.
InvokeEventListener(Event)
Calls the listener registered for the given event.
public void InvokeEventListener(Event ev)
Parameters
ev
EventThe event that asks for the listeners.
RemoveEventListener(string, DomEventHandler?, bool)
Removes an event listener from the Node.
public 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.
RemoveEventListeners()
Removes all listeners.
public void RemoveEventListeners()