create_event method

create_event

Creates an Event of a type supported by the implementation.

Returns

The newly created Event

def create_event(self, event_type):
    ...
ParameterTypeDescription
event_typestrThe eventType parameter specifies the type of Event interface to be created.

If the Event interface specified is supported by the implementation this method will
return a new Event of the interface type requested.
If the Event is to be dispatched via the IEventTarget.dispatch_event method the appropriate Event.init_event
method must be called after creation in order to initialize the Event’s values.


The IDocumentEvent.create_event method is used in creating Events when it is either inconvenient or unnecessary
for the user to create an Event themselves.
In cases where the implementation provided Event is insufficient, users may supply
their own Event implementations for use with the IEventTarget.dispatch_event method.

Exceptions

ExceptionDescription
DOMExceptionNOT_SUPPORTED_ERR: Raised if the implementation does not support the type of Event interface requested

See Also