Class Event
Namespace: Aspose.Html.Dom.Events
Assembly: Aspose.HTML.dll (25.2.0)
The Aspose.Html.Dom.Events.Event is used to provide contextual information about an event to the handler processing the event.
[DOMObject]
[ComVisible(true)]
[DOMName("Event")]
public class Event : DOMObject, INotifyPropertyChanged
Inheritance
Derived
CustomEvent, ErrorEvent, SVGZoomEvent, TimeEvent, UIEvent
Implements
Inherited Members
DOMObject.GetPlatformType(), object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
An object which implements the Aspose.Html.Dom.Events.Event is generally passed as the first parameter to an event handler.
More specific context information is passed to event handlers by deriving additional interfaces from Aspose.Html.Dom.Events.Event
which contain information directly relating to the type of event they accompany.
These derived interfaces are also implemented by the object passed to the event listener.
Constructors
Event(string)
Initializes a new instance of the Aspose.Html.Dom.Events.Event class.
[DOMConstructor]
public Event(string type)
Parameters
type
string
The event type.
Event(string, IDictionary<string, object="">)
Initializes a new instance of the Aspose.Html.Dom.Events.Event class.
[DOMConstructor]
public Event(string type, IDictionary<string, object=""> eventInitDict)
Parameters
type
string
The event type.
eventInitDict
IDictionary<string, object>
The event initialize dictionary.
Fields
AtTargetPhase
The current event phase is the capturing phase.
[DOMName("AT_TARGET")]
public const ushort AtTargetPhase = 2
Field Value
BubblingPhase
The current event phase is the bubbling phase.
[DOMName("BUBBLING_PHASE")]
public const ushort BubblingPhase = 3
Field Value
CapturingPhase
The event is currently being evaluated at the target Aspose.Html.Dom.Events.IEventTarget.
[DOMName("CAPTURING_PHASE")]
public const ushort CapturingPhase = 1
Field Value
NonePhase
Events not currently dispatched are in this phase.
[DOMName("NONE")]
public const ushort NonePhase = 0
Field Value
Properties
Bubbles
Used to indicate whether or not an event is a bubbling event. If the event can bubble the value is true, else the value is false.
[DOMName("bubbles")]
public bool Bubbles { get; }
Property Value
Cancelable
Used to indicate whether or not an event can have its default action prevented. If the default action can be prevented the value is true, else the value is false.
[DOMName("cancelable")]
public bool Cancelable { get; }
Property Value
CurrentTarget
Used to indicate the Aspose.Html.Dom.Events.IEventTarget whose Aspose.Html.Dom.Events.IEventListeners are currently being processed. This is particularly useful during capturing and bubbling.
[DOMNullable]
[DOMName("currentTarget")]
public EventTarget CurrentTarget { get; }
Property Value
DefaultPrevented
Returns true if preventDefault() was invoked while the cancelable attribute value is true, and false otherwise.
[DOMName("defaultPrevented")]
public bool DefaultPrevented { get; }
Property Value
EventPhase
Used to indicate which phase of event flow is currently being evaluated.
[DOMName("eventPhase")]
public ushort EventPhase { get; }
Property Value
IsTrusted
The isTrusted attribute must return the value it was initialized to. When an event is created the attribute must be initialized to false.
[DOMName("isTrusted")]
public bool IsTrusted { get; }
Property Value
Target
Used to indicate the Aspose.Html.Dom.Events.IEventTarget to which the event was originally dispatched.
[DOMName("target")]
[DOMNullable]
public EventTarget Target { get; }
Property Value
TimeStamp
Used to specify the time (in milliseconds relative to the epoch) at which the event was created. Due to the fact that some systems may not provide this information the value of timeStamp may be not available for all events. When not available, a value of 0 will be returned. Examples of epoch time are the time of the system start or 0:0:0 UTC 1st January 1970.
[DOMName("timeStamp")]
public ulong TimeStamp { get; }
Property Value
Type
The name of the event (case-insensitive). The name must be an XML name.
[DOMName("type")]
public string Type { get; }
Property Value
Methods
InitEvent(string, bool, bool)
The Aspose.Html.Dom.Events.Event.InitEvent(System.String,System.Boolean,System.Boolean) method is used to initialize the value of an Aspose.Html.Dom.Events.Event created through the Aspose.Html.Dom.Events.IDocumentEvent interface.
[DOMName("initEvent")]
public void InitEvent(string type, bool bubbles, bool cancelable)
Parameters
type
string
The event type.
bubbles
bool
if set to true
[bubbles].
cancelable
bool
if set to true
[cancelable].
Remarks
This method may only be called before the Event has been dispatched via the Aspose.Html.Dom.Events.IEventTarget.DispatchEvent(Aspose.Html.Dom.Events.Event) method, though it may be called multiple times during that phase if necessary. If called multiple times the final invocation takes precedence. If called from a subclass of Event interface only the values specified in the initEvent method are modified, all other attributes are left unchanged.
PreventDefault()
If an event is cancelable, the Aspose.Html.Dom.Events.Event.PreventDefault method is used to signify that the event is to be canceled, meaning any default action normally taken by the implementation as a result of the event will not occur.
[DOMName("preventDefault")]
public void PreventDefault()
Remarks
If, during any stage of event flow, the Aspose.Html.Dom.Events.Event.PreventDefault method is called the event is canceled. Any default action associated with the event will not occur. Calling this method for a non-cancelable event has no effect. Once Aspose.Html.Dom.Events.Event.PreventDefault has been called it will remain in effect throughout the remainder of the event’s propagation. This method may be used during any stage of event flow.
StopImmediatePropagation()
Invoking this method prevents event from reaching any event listeners registered after the current one and when dispatched in a tree also prevents event from reaching any other objects.
[DOMName("stopImmediatePropagation")]
public void StopImmediatePropagation()
StopPropagation()
The Aspose.Html.Dom.Events.Event.StopPropagation method is used prevent further propagation of an event during event flow.
[DOMName("stopPropagation")]
public void StopPropagation()
Remarks
If this method is called by any Aspose.Html.Dom.Events.IEventListener the event will cease propagating through the tree. The event will complete dispatch to all listeners on the current Aspose.Html.Dom.Events.IEventTarget before event flow stops. This method may be used during any stage of event flow. </string,></string,>