Class EventTarget
Namespace: Aspose.Html.Dom
Assembly: Aspose.HTML.dll (25.2.0)
The Aspose.Html.Dom.EventTarget interface is implemented by all Nodes in an implementation which supports the DOM Event Model. Therefore, this interface can be obtained by using binding-specific casting methods on an instance of the Node interface. The interface allows registration and removal of Event Listeners on an Aspose.Html.Dom.EventTarget and dispatch of events to that Aspose.Html.Dom.Events.IEventTarget.
[ComVisible(true)]
[DOMName("EventTarget")]
[DOMObject]
public class EventTarget : DOMObject, INotifyPropertyChanged, IEventTarget, IDisposable
Inheritance
object ← DOMObject ← EventTarget
Derived
Implements
INotifyPropertyChanged, IEventTarget, IDisposable
Inherited Members
DOMObject.GetPlatformType(), object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
EventTarget()
public EventTarget()
Methods
AddEventListener(string, DOMEventHandler, bool)
This method allows the registration of event listeners on the event target.
public void AddEventListener(string type, DOMEventHandler handler, bool useCapture)
Parameters
type
string
The event type for which the user is registering
handler
DOMEventHandler
Takes an Aspose.Html.Dom.Events.DOMEventHandler to be called when the event occurs.
useCapture
bool
If true, useCapture indicates that the user wishes to initiate capture. After initiating capture, all events of the specified type will be dispatched to the registered Aspose.Html.Dom.Events.IEventListener before being dispatched to any Event Targets beneath them in the tree. Events which are bubbling upward through the tree will not trigger an Aspose.Html.Dom.Events.IEventListener designated to use capture.
Remarks
If an Aspose.Html.Dom.Events.IEventListener is added to an Aspose.Html.Dom.EventTarget while it is processing an event, it will not be triggered by the current actions but may be triggered during a later stage of event flow, such as the bubbling phase.
If multiple identical Event Listeners are registered on the same Aspose.Html.Dom.EventTarget with the same parameters the duplicate instances are discarded. They do not cause the Aspose.Html.Dom.Events.IEventListener to be called twice and since they are discarded they do not need to be removed with the Aspose.Html.Dom.EventTarget.RemoveEventListener(System.String,Aspose.Html.Dom.Events.DOMEventHandler,System.Boolean) method.
AddEventListener(string, IEventListener)
This method allows the registration of event listeners on the event target.
public void AddEventListener(string type, IEventListener listener)
Parameters
type
string
The event type for which the user is registering
listener
IEventListener
Takes an interface implemented by the user which contains the methods to be called when the event occurs.
Remarks
If an Aspose.Html.Dom.Events.IEventListener is added to an Aspose.Html.Dom.EventTarget while it is processing an event, it will not be triggered by the current actions but may be triggered during a later stage of event flow, such as the bubbling phase.
If multiple identical Event Listeners are registered on the same Aspose.Html.Dom.EventTarget with the same parameters the duplicate instances are discarded. They do not cause the Aspose.Html.Dom.Events.IEventListener to be called twice and since they are discarded they do not need to be removed with the Aspose.Html.Dom.EventTarget.RemoveEventListener(System.String,Aspose.Html.Dom.Events.DOMEventHandler,System.Boolean) method.
AddEventListener(string, IEventListener, bool)
This method allows the registration of event listeners on the event target.
public void AddEventListener(string type, IEventListener listener, bool useCapture)
Parameters
type
string
The event type for which the user is registering
listener
IEventListener
Takes an interface implemented by the user which contains the methods to be called when the event occurs.
useCapture
bool
If true, useCapture indicates that the user wishes to initiate capture. After initiating capture, all events of the specified type will be dispatched to the registered Aspose.Html.Dom.Events.IEventListener before being dispatched to any Event Targets beneath them in the tree. Events which are bubbling upward through the tree will not trigger an Aspose.Html.Dom.Events.IEventListener designated to use capture.
Remarks
If an Aspose.Html.Dom.Events.IEventListener is added to an Aspose.Html.Dom.EventTarget while it is processing an event, it will not be triggered by the current actions but may be triggered during a later stage of event flow, such as the bubbling phase.
If multiple identical Event Listeners are registered on the same Aspose.Html.Dom.EventTarget with the same parameters the duplicate instances are discarded. They do not cause the Aspose.Html.Dom.Events.IEventListener to be called twice and since they are discarded they do not need to be removed with the Aspose.Html.Dom.EventTarget.RemoveEventListener(System.String,Aspose.Html.Dom.Events.DOMEventHandler,System.Boolean) method.
DispatchEvent(Event)
This method allows the dispatch of events into the implementations event model.
public bool DispatchEvent(Event @event)
Parameters
event
Event
Specifies the event type, behavior, and contextual information to be used in processing the event.
Returns
The return value of Aspose.Html.Dom.EventTarget.DispatchEvent(Aspose.Html.Dom.Events.Event) indicates whether any of the listeners which handled the event called Aspose.Html.Dom.Events.Event.PreventDefault. If Aspose.Html.Dom.Events.Event.PreventDefault was called the value is false, else the value is true.
Remarks
Events dispatched in this manner will have the same capturing and bubbling behavior as events dispatched directly by the implementation. The target of the event is the Aspose.Html.Dom.EventTarget on which Aspose.Html.Dom.EventTarget.DispatchEvent(Aspose.Html.Dom.Events.Event) is called.
Exceptions
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected virtual void Dispose(bool disposing)
Parameters
disposing
bool
true
to release both managed and unmanaged resources; false
to release only unmanaged resources.
RemoveEventListener(string, DOMEventHandler, bool)
This method allows the removal of event listeners from the event target. If an Aspose.Html.Dom.Events.IEventListener is removed from an Aspose.Html.Dom.EventTarget while it is processing an event, it will not be triggered by the current actions. Event Listeners can never be invoked after being removed.
public void RemoveEventListener(string type, DOMEventHandler handler, bool useCapture)
Parameters
type
string
Specifies the event type of the Aspose.Html.Dom.Events.IEventListener being removed.
handler
DOMEventHandler
The Aspose.Html.Dom.Events.DOMEventHandler parameter indicates the Aspose.Html.Dom.Events.IEventListener to be removed.
useCapture
bool
Specifies whether the EventListener being removed was registered as a capturing listener or not. If a listener was registered twice, one with capture and one without, each must be removed separately. Removal of a capturing listener does not affect a non-capturing version of the same listener, and vice versa.
RemoveEventListener(string, IEventListener)
This method allows the removal of event listeners from the event target. If an Aspose.Html.Dom.Events.IEventListener is removed from an Aspose.Html.Dom.EventTarget while it is processing an event, it will not be triggered by the current actions. Event Listeners can never be invoked after being removed.
public void RemoveEventListener(string type, IEventListener listener)
Parameters
type
string
Specifies the event type of the Aspose.Html.Dom.Events.IEventListener being removed.
listener
IEventListener
The Aspose.Html.Dom.Events.IEventListener parameter indicates the Aspose.Html.Dom.Events.IEventListener to be removed.
RemoveEventListener(string, IEventListener, bool)
This method allows the removal of event listeners from the event target. If an Aspose.Html.Dom.Events.IEventListener is removed from an Aspose.Html.Dom.EventTarget while it is processing an event, it will not be triggered by the current actions. Event Listeners can never be invoked after being removed.
public void RemoveEventListener(string type, IEventListener listener, bool useCapture)
Parameters
type
string
Specifies the event type of the Aspose.Html.Dom.Events.IEventListener being removed.
listener
IEventListener
The Aspose.Html.Dom.Events.IEventListener parameter indicates the Aspose.Html.Dom.Events.IEventListener to be removed.
useCapture
bool
Specifies whether the EventListener being removed was registered as a capturing listener or not. If a listener was registered twice, one with capture and one without, each must be removed separately. Removal of a capturing listener does not affect a non-capturing version of the same listener, and vice versa.