Enum script::dom::event::EventDefault
source · pub enum EventDefault {
Allowed,
Prevented,
Handled,
}
Expand description
An enum to indicate whether the default action of an event is allowed.
This should’ve been a bool. Instead, it’s an enum, because, aside from the allowed/canceled
states, we also need something to stop the event from being handled again (without cancelling
the event entirely). For example, an Up/Down KeyEvent
inside a textarea
element will
trigger the cursor to go up/down if the text inside the element spans multiple lines. This enum
helps us to prevent such events from being sent to the constellation where it will be
handled once again for page scrolling (which is definitely not what we’d want).
Variants§
Allowed
The default action of the event is allowed (constructor’s default)
Prevented
The default action has been prevented by calling PreventDefault
Handled
The event has been handled somewhere in the DOM, and it should be prevented from being
re-handled elsewhere. This doesn’t affect the judgement of DefaultPrevented
Trait Implementations§
source§impl Clone for EventDefault
impl Clone for EventDefault
source§fn clone(&self) -> EventDefault
fn clone(&self) -> EventDefault
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl MallocSizeOf for EventDefault
impl MallocSizeOf for EventDefault
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl PartialEq<EventDefault> for EventDefault
impl PartialEq<EventDefault> for EventDefault
source§fn eq(&self, other: &EventDefault) -> bool
fn eq(&self, other: &EventDefault) -> bool
self
and other
values to be equal, and is used
by ==
.