pub enum DomError {
NodeNotFound(NodeId),
NoRootElement,
InvalidSelector(String),
InvalidClassToken(String),
UnknownAtom(AtomId),
TreeInvariant(&'static str),
}Expand description
Why a DOM operation could not be performed.
Deliberately narrow. Most of blitz-script’s operations are tolerant
where the DOM specification is strict: reading an attribute off a node that
is not an element yields “absent” rather than throwing, and removing a
child that is not a child removes it from wherever it actually is. Those
behaviours are copied rather than corrected, so they do not appear here.
What does appear is every case where blitz-script itself raises, plus the
tree invariants it asserts with expect.
Variants§
NodeNotFound(NodeId)
The node id does not name a node in this document.
Only produced where blitz-script would panic rather than return.
NoRootElement
The document has no root element, so there is nothing to answer with.
InvalidSelector(String)
A selector string could not be parsed.
blitz-script swallows this: querySelector returns null, matches
returns false, closest searches an empty match set. This crate
surfaces it instead, and the reparenting diff for each of those call
sites is a trailing .ok().flatten() or .unwrap_or_default().
InvalidClassToken(String)
A classList token was empty or contained ASCII whitespace.
blitz-script raises a SyntaxError here; this is the same case.
UnknownAtom(AtomId)
An AtomId was resolved against an interner that did not mint it.
TreeInvariant(&'static str)
A structural invariant the operation relies on did not hold.
compare_document_position is the only current source: it walks to a
common ancestor and then indexes into it, and blitz-script asserts
both steps with expect. A facade must not take the process down over
a malformed tree, so the assertion becomes this.
Trait Implementations§
impl Eq for DomError
Source§impl Error for DomError
impl Error for DomError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
impl StructuralPartialEq for DomError
Auto Trait Implementations§
impl Freeze for DomError
impl RefUnwindSafe for DomError
impl Send for DomError
impl Sync for DomError
impl Unpin for DomError
impl UnsafeUnpin for DomError
impl UnwindSafe for DomError
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
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