pub struct DomTokenList { /* private fields */ }Expand description
Snapshot of an element’s ordered class tokens (DOM
Element.classList read-side view). Re-construct via the
element accessor to refresh after a class mutation.
tokens preserves the iteration order of the underlying
class set; rdom-core stores classes in a BTreeSet, so
iteration is alphabetic. Browsers preserve insertion order;
this is a documented divergence (the same one class_list()
has carried since Phase 1).
Implementations§
Source§impl DomTokenList
impl DomTokenList
Sourcepub fn from_tokens(tokens: impl IntoIterator<Item = String>) -> Self
pub fn from_tokens(tokens: impl IntoIterator<Item = String>) -> Self
Construct from an iterator of class tokens. Used by the
NodeRef::class_list() integration (M4b step 14); exposed
publicly so tests and other consumers can build snapshots
directly.
Sourcepub fn item(&self, index: usize) -> Option<&str>
pub fn item(&self, index: usize) -> Option<&str>
Borrow the token at index, or None if out of bounds.
DOM item(i).
Sourcepub fn value(&self) -> String
pub fn value(&self) -> String
Re-serialize the snapshot as a space-joined string. DOM
value / toString().
Trait Implementations§
Source§impl Clone for DomTokenList
impl Clone for DomTokenList
Source§impl Debug for DomTokenList
impl Debug for DomTokenList
impl Eq for DomTokenList
Source§impl Hash for DomTokenList
impl Hash for DomTokenList
Source§impl PartialEq for DomTokenList
impl PartialEq for DomTokenList
impl StructuralPartialEq for DomTokenList
Auto Trait Implementations§
impl Freeze for DomTokenList
impl RefUnwindSafe for DomTokenList
impl Send for DomTokenList
impl Sync for DomTokenList
impl Unpin for DomTokenList
impl UnsafeUnpin for DomTokenList
impl UnwindSafe for DomTokenList
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
Mutably borrows from an owned value. Read more