pub struct HtmlCollection<'a, Ext: 'static> { /* private fields */ }Expand description
Snapshot of element ids captured at construction with
name-based lookup. Used by form.elements,
getElementsByTagName, etc.
Implementations§
Source§impl<'a, Ext: 'static> HtmlCollection<'a, Ext>
impl<'a, Ext: 'static> HtmlCollection<'a, Ext>
Sourcepub fn from_ids(
dom: &'a Dom<Ext>,
nodes: impl IntoIterator<Item = NodeId>,
) -> Self
pub fn from_ids( dom: &'a Dom<Ext>, nodes: impl IntoIterator<Item = NodeId>, ) -> Self
Construct from an iterator of element ids and a borrowed
Dom. Used by form.elements() (M4b step 30) and tests.
Sourcepub fn item(&self, index: usize) -> Option<NodeRef<'a, Ext>>
pub fn item(&self, index: usize) -> Option<NodeRef<'a, Ext>>
Borrow the i-th element if (a) the index is in range and
(b) the underlying id still resolves to a live element.
DOM item(i).
Sourcepub fn named_item(&self, name: &str) -> Option<NodeRef<'a, Ext>>
pub fn named_item(&self, name: &str) -> Option<NodeRef<'a, Ext>>
Look up the first element whose name attribute matches
name, falling back to id attribute. Matches DOM
namedItem (the “named property getter” on
HTMLCollection). Snapshot-resolved — removed nodes are
skipped even if their id was in the original snapshot.
Auto Trait Implementations§
impl<'a, Ext> !RefUnwindSafe for HtmlCollection<'a, Ext>
impl<'a, Ext> !Send for HtmlCollection<'a, Ext>
impl<'a, Ext> !Sync for HtmlCollection<'a, Ext>
impl<'a, Ext> !UnwindSafe for HtmlCollection<'a, Ext>
impl<'a, Ext> Freeze for HtmlCollection<'a, Ext>
impl<'a, Ext> Unpin for HtmlCollection<'a, Ext>
impl<'a, Ext> UnsafeUnpin for HtmlCollection<'a, Ext>where
&'a Dom<Ext>: UnsafeUnpin,
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