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 for EventDefault
impl PartialEq for EventDefault
source§impl Traceable for EventDefault
impl Traceable for EventDefault
impl Copy for EventDefault
impl StructuralPartialEq for EventDefault
Auto Trait Implementations§
impl Freeze for EventDefault
impl RefUnwindSafe for EventDefault
impl Send for EventDefault
impl Sync for EventDefault
impl Unpin for EventDefault
impl UnwindSafe for EventDefault
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more