This section is about the management of action in the Document object model (ie in the browser)
An event allows for signaling that something has occurred, e.g., that an image has completed downloading.
Event are code structures that listen out for things happening to the document.
In the DOM specification, you can find the following:
The callback function that handle the event can be created with the help of:
and get back an event object
The following features are defined in the DOM Events specification:
An event's type is synonymous of name type (ie “an event named click” or “if the event name is keypress”)
For example, the following document fragment:
<button class="btn btn-info" onclick="console.log('Bouh!')" >Click Me</button>
In the contexts of events, the terms fire and dispatch are used as defined in the DOM specification:
Dispatching an event means to follow the steps that propagate the event through the tree.
The term trusted event is used to refer to events whose isTrusted attribute is initialized to true
The type of an event categorize the event. It's also known as the name of the event (Ref)
Example:
In the chrome devtool
An event may bubble (ie propagate) up the dom tree to other subscriber.
If you don't want to have the default behavior (such as following a link), you can prevent it (stop it)
The structure of an event can be found in the Event interface definition.
You can also create your own event type. See How to create your own custom event type (Javascript, DOM)?