Struct lol_html::Selector [−][src]
Parsed CSS selector.
Parsed selector can be used for different element content handlers without a necessity to re-parse CSS selector string for each of them.
Example
The structure implements the FromStr
trait, so it can be constructed through
str
’s parse
method.
use lol_html::Selector; let selector: Selector = "#foo".parse().unwrap();
Supported selector
Currently the rewriter supports the following CSS selectors:
Pattern | Represents |
---|---|
* | any element |
E | any element of type E |
E:nth-child(n) | an E element, the n-th child of its parent |
E:first-child | an E element, first child of its parent |
E:nth-of-type(n) | an E element, the n-th sibling of its type |
E:first-of-type | an E element, first sibling of its type |
E:not(s) | an E element that does not match either compound selector s |
E.warning | an E element belonging to the class warning |
E#myid | an E element with ID equal to "myid" . |
E[foo] | an E element with a foo attribute |
E[foo="bar"] | an E element whose foo attribute value is exactly equal to "bar" |
E[foo="bar" i] | an E element whose foo attribute value is exactly equal to any (ASCII-range) case-permutation of "bar" |
E[foo="bar" s] | an E element whose foo attribute value is exactly and case-sensitively equal to "bar" |
E[foo~="bar"] | an E element whose foo attribute value is a list of whitespace-separated values, one of which is exactly equal to "bar" |
E[foo^="bar"] | an E element whose foo attribute value begins exactly with the string "bar" |
E[foo$="bar"] | an E element whose foo attribute value ends exactly with the string "bar" |
E[foo*="bar"] | an E element whose foo attribute value contains the substring "bar" |
E[foo|=“en”] | an E element whose foo attribute value is a hyphen-separated list of values beginning with "en" |
E F | an F element descendant of an E element |
E > F | an F element child of an E element |
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Selector
impl Send for Selector
impl Sync for Selector
impl Unpin for Selector
impl UnwindSafe for Selector
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,
pub 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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.
pub 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>,