[−][src]Struct nipper::Selection
Methods
impl<'a> Selection<'a>
[src]
pub fn set_html<T>(&mut self, html: T) where
T: Into<StrTendril>,
[src]
T: Into<StrTendril>,
set the html contents of each element in the selection to specified parsed HTML.
pub fn replace_with_html<T>(&mut self, html: T) where
T: Into<StrTendril>,
[src]
T: Into<StrTendril>,
replace_with_html replaces each element in the set of matched elements with the parsed HTML. It returns the removed elements.
This follows the same rules as append
.
pub fn append_html<T>(&mut self, html: T) where
T: Into<StrTendril>,
[src]
T: Into<StrTendril>,
append_thml parses the html and appends it to the set of matched elements.
impl<'a> Selection<'a>
[src]
pub fn attr(&self, name: &str) -> Option<StrTendril>
[src]
attr gets the specified attribute's value for the first element in the selection. To get the value for each element individually, use a looping construct such as map method.
pub fn set_attr(&mut self, name: &str, val: &str)
[src]
sets the given attribute to each element in the set of matched elements.
pub fn remove_attr(&mut self, name: &str)
[src]
remove_attr removes the named attribute from each element in the set of matched elements.
pub fn length(&self) -> usize
[src]
length returns the number of elements in the selection object.
pub fn size(&self) -> usize
[src]
size is an alias for length
.
pub fn attr_or(&self, name: &str, default: &str) -> StrTendril
[src]
attor_or works like attr
but returns default value if attribute is not present.
pub fn html(&self) -> StrTendril
[src]
html gets the HTML contents of the first element in the set of matched elements. It includes the text and comment nodes.
pub fn text(&self) -> StrTendril
[src]
text get the combined text content of each element in the set of matched elements, including their descendants.
impl<'a> Selection<'a>
[src]
pub fn is(&self, sel: &str) -> bool
[src]
Checks the current matched set of elements against a selector and returns true if at least one of these elements matches.
pub fn is_matcher(&self, matcher: &Matcher) -> bool
[src]
Checks the current matched set of elements against a matcher and returns true if at least one of these elements matches.
pub fn is_selection(&self, sel: &Selection) -> bool
[src]
Checks the current matches set of elemets against a selection and returns true if at least one of these elements matches.
impl<'a> Selection<'a>
[src]
pub fn select(&self, sel: &str) -> Selection<'a>
[src]
pub fn iter(&self) -> Selections<NodeRef<'a, NodeData>>
[src]
pub fn nodes(&self) -> &[NodeRef<'a, NodeData>]
[src]
pub fn remove(&self)
[src]
pub fn get(&self, index: usize) -> Option<&NodeRef<'a, NodeData>>
[src]
impl<'a> Selection<'a>
[src]
pub fn parent(&self) -> Self
[src]
parents gets the parent of each element in the selection. It returns a mew selection containing these elements.
pub fn children(&self) -> Self
[src]
children gets the child elements of each element in the selection. It returns a new selection containing these elements.
pub fn next(&self) -> Self
[src]
next gets the immediately following sibling of each element in the selection. It returns a new selection containing these elements.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Selection<'a>
impl<'a> !Send for Selection<'a>
impl<'a> !Sync for Selection<'a>
impl<'a> Unpin for Selection<'a>
impl<'a> !UnwindSafe for Selection<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,