cancelable property
The cancelable
read-only property of the Event
interface indicates
whether the event
can be canceled, and therefore prevented as if the event never happened.
If the event is not cancelable, then its cancelable
property will be
false
and the event listener cannot stop the event from occurring.
Most browser-native events that can be canceled are the ones that result
from the user
interacting with the page. Canceling the Element.click_event
,
Element.wheel_event
, or
Window.beforeunload_event
events would prevent the user
from clicking on something, scrolling the page with the mouse wheel, or
navigating away from the page, respectively.
Synthetic events created by other JavaScript code define if they can be canceled when they are created.
To cancel an event, call the event.preventDefault
method on the event. This keeps the implementation from executing the
default action
that is associated with the event.
Event listeners that handle multiple kinds of events may want to check
cancelable
before invoking their event.preventDefault
methods.
Implementation
external bool get cancelable;