mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Refactor 'listed element' logic for HTMLFieldSetElement::Elements
`HTMLElement::is_listed_element` method was added, which matches the `HTMLElement::is_labelable_element` method directly above
This commit is contained in:
parent
083d3e0201
commit
e3728f6167
2 changed files with 27 additions and 4 deletions
|
@ -18,7 +18,7 @@ use dom::validitystate::ValidityState;
|
|||
use dom::virtualmethods::VirtualMethods;
|
||||
use selectors::states::*;
|
||||
use string_cache::Atom;
|
||||
use util::str::{DOMString, StaticStringVec};
|
||||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLFieldSetElement {
|
||||
|
@ -52,9 +52,8 @@ impl HTMLFieldSetElementMethods for HTMLFieldSetElement {
|
|||
struct ElementsFilter;
|
||||
impl CollectionFilter for ElementsFilter {
|
||||
fn filter<'a>(&self, elem: &'a Element, _root: &'a Node) -> bool {
|
||||
static TAG_NAMES: StaticStringVec = &["button", "fieldset", "input",
|
||||
"keygen", "object", "output", "select", "textarea"];
|
||||
TAG_NAMES.iter().any(|&tag_name| tag_name == &**elem.local_name())
|
||||
elem.downcast::<HTMLElement>()
|
||||
.map_or(false, HTMLElement::is_listed_element)
|
||||
}
|
||||
}
|
||||
let filter = box ElementsFilter;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue