Event Class
https://dom.spec.whatwg.org/#interface-event
public class EventConstructors
| Name | Description |
|---|---|
| Event(string, EventInit?) | https://dom.spec.whatwg.org/#dom-event-event |
Event(string, EventInit?)
Event.cshttps://dom.spec.whatwg.org/#dom-event-event
Properties
| Name | Description |
|---|---|
| Bubbles | Gets a value indicating whether the event bubbles up through the tree. |
| CancelBubble | Gets or sets the legacy stop propagation flag; setting it to true stops the propagation of the event. |
| Cancelable | Gets a value indicating whether the event can be canceled with preventDefault(). |
| Composed | Gets a value indicating whether the event propagates across the shadow DOM boundary. |
| CurrentTarget | Gets the object whose listener is currently being invoked. |
| DefaultPrevented | Gets a value indicating whether the event has been canceled. |
| EventPhase | Gets the current phase of the event dispatch (NONE, CAPTURING_PHASE, AT_TARGET or BUBBLING_PHASE). |
| IsTrusted | Gets a value indicating whether the event was dispatched by the user agent rather than created by a script. |
| ReturnValue | Gets or sets the legacy inverse of defaultPrevented; setting it to false cancels the event. |
| SrcElement | Gets the object the event was dispatched to (legacy alias of target). |
| Target | Gets the object the event was dispatched to. |
| TimeStamp | The time the event was created, in milliseconds relative to the time origin. |
| Type | Gets the type of the event, such as click. |
Bubbles
Event.csGets a value indicating whether the event bubbles up through the tree.
public bool Bubbles { get; }CancelBubble
Event.csGets or sets the legacy stop propagation flag; setting it to true stops the propagation of the event.
public bool CancelBubble { get; set; }Cancelable
Event.csGets a value indicating whether the event can be canceled with preventDefault().
public bool Cancelable { get; }Composed
Event.csGets a value indicating whether the event propagates across the shadow DOM boundary.
public bool Composed { get; }CurrentTarget
Event.csGets the object whose listener is currently being invoked.
public EventTarget? CurrentTarget { get; }DefaultPrevented
Event.csGets a value indicating whether the event has been canceled.
public bool DefaultPrevented { get; }EventPhase
Event.csGets the current phase of the event dispatch (NONE, CAPTURING_PHASE, AT_TARGET or BUBBLING_PHASE).
public ushort EventPhase { get; }IsTrusted
Event.csGets a value indicating whether the event was dispatched by the user agent rather than created by a script.
public bool IsTrusted { get; }ReturnValue
Event.csGets or sets the legacy inverse of defaultPrevented; setting it to false cancels the event.
public bool ReturnValue { get; set; }SrcElement
Event.csGets the object the event was dispatched to (legacy alias of target).
public EventTarget? SrcElement { get; }Target
Event.csGets the object the event was dispatched to.
public EventTarget? Target { get; }TimeStamp
Event.csThe time the event was created, in milliseconds relative to the time origin.
public double TimeStamp { get; }Type
Event.csGets the type of the event, such as click.
public string Type { get; }Methods
| Name | Description |
|---|---|
| ComposedPath() | https://dom.spec.whatwg.org/#dom-event-composedpath |
| InitEvent(string, bool, bool) | https://dom.spec.whatwg.org/#dom-event-initevent |
| PreventDefault() | Cancels the event when it is cancelable. |
| StopImmediatePropagation() | Prevents the event from reaching the other listeners, including the remaining listeners of the current target. |
| StopPropagation() | Prevents the event from reaching the listeners of the other objects of its path. |
ComposedPath()
Event.cshttps://dom.spec.whatwg.org/#dom-event-composedpath
public IReadOnlyList<EventTarget> ComposedPath()InitEvent(string, bool, bool)
Event.csPreventDefault()
Event.csCancels the event when it is cancelable.
public void PreventDefault()StopImmediatePropagation()
Event.csPrevents the event from reaching the other listeners, including the remaining listeners of the current target.
public void StopImmediatePropagation()StopPropagation()
Event.csPrevents the event from reaching the listeners of the other objects of its path.
public void StopPropagation()Constants
| Name | Description |
|---|---|
| AtTarget | The event has reached its target. |
| BubblingPhase | The event is propagating back up through the ancestors of the target. |
| CapturingPhase | The event is propagating through the ancestors of the target, from the root. |
| None | The event is not being dispatched. |
AtTarget
The event has reached its target.
public const ushort AtTarget = 2BubblingPhase
The event is propagating back up through the ancestors of the target.
public const ushort BubblingPhase = 3CapturingPhase
The event is propagating through the ancestors of the target, from the root.
public const ushort CapturingPhase = 1None
The event is not being dispatched.
public const ushort None = 0