Table of Contents

Class EventTargetExtensions

Namespace
AngleSharp.Dom
Assembly
AngleSharp.dll

A set of extensions for EventTarget objects.

public static class EventTargetExtensions
Inheritance
EventTargetExtensions
Inherited Members

Methods

AwaitEventAsync<TEventTarget>(TEventTarget, string)

Returns a task that is completed once the event is fired.

public static Task<Event> AwaitEventAsync<TEventTarget>(this TEventTarget node, string eventName) where TEventTarget : IEventTarget

Parameters

node TEventTarget

The node that fires the event.

eventName string

The name of the event to be awaited.

Returns

Task<Event>

The awaitable task returning the event arguments.

Type Parameters

TEventTarget

The event target type.

Fire(IEventTarget, Event)

Fires a trusted event with the provided event data.

public static bool Fire(this IEventTarget target, Event eventData)

Parameters

target IEventTarget

The target of the event.

eventData Event

The event data to dispatch.

Returns

bool

True if the element was cancelled, otherwise false.

FireSimpleEvent(IEventTarget, string, bool, bool)

Firing a simple event means that a trusted event with a name, which does not bubble, is not cancelable and which uses the Event interface. It is created and dispatched at the given target.

public static bool FireSimpleEvent(this IEventTarget target, string eventName, bool bubble = false, bool cancelable = false)

Parameters

target IEventTarget

The target of the simple event.

eventName string

The name of the event to be fired.

bubble bool

Optional parameter to enable bubbling.

cancelable bool

Should it be cancelable?

Returns

bool

True if the element was cancelled, otherwise false.

Fire<T>(IEventTarget, Action<T>, IEventTarget?)

Firing an event means dispatching the initialized (and trusted) event at the specified event target.

public static bool Fire<T>(this IEventTarget target, Action<T> initializer, IEventTarget? targetOverride = null) where T : Event, new()

Parameters

target IEventTarget

The target, where the event has been invoked.

initializer Action<T>

The used initializer.

targetOverride IEventTarget

The current event target, if different to the invoked target.

Returns

bool

True if the element was cancelled, otherwise false.

Type Parameters

T