mirror of
https://github.com/servo/servo.git
synced 2025-07-22 06:43:40 +01:00
Implement has_class.
This commit is contained in:
parent
f468166dc3
commit
eb0cd93d7d
1 changed files with 4 additions and 2 deletions
|
@ -454,8 +454,10 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
self.get_attr(&ns!(), &atom!("id")).map(|s| Atom::from(s))
|
self.get_attr(&ns!(), &atom!("id")).map(|s| Atom::from(s))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_class(&self, _name: &Atom) -> bool {
|
fn has_class(&self, name: &Atom) -> bool {
|
||||||
unimplemented!()
|
// FIXME(bholley): Do this smarter.
|
||||||
|
self.get_attr(&ns!(), &atom!("class"))
|
||||||
|
.map_or(false, |classes| classes.split(" ").any(|n| &Atom::from(n) == name))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn each_class<F>(&self, mut callback: F) where F: FnMut(&Atom) {
|
fn each_class<F>(&self, mut callback: F) where F: FnMut(&Atom) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue