mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +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
|
@ -354,6 +354,30 @@ impl HTMLElement {
|
|||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#category-listed
|
||||
pub fn is_listed_element(&self) -> bool {
|
||||
// Servo does not implement HTMLKeygenElement
|
||||
// https://github.com/servo/servo/issues/2782
|
||||
if self.upcast::<Element>().local_name() == &atom!("keygen") {
|
||||
return true;
|
||||
}
|
||||
|
||||
match self.upcast::<Node>().type_id() {
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(type_id)) =>
|
||||
match type_id {
|
||||
HTMLElementTypeId::HTMLButtonElement |
|
||||
HTMLElementTypeId::HTMLFieldSetElement |
|
||||
HTMLElementTypeId::HTMLInputElement |
|
||||
HTMLElementTypeId::HTMLObjectElement |
|
||||
HTMLElementTypeId::HTMLOutputElement |
|
||||
HTMLElementTypeId::HTMLSelectElement |
|
||||
HTMLElementTypeId::HTMLTextAreaElement => true,
|
||||
_ => false,
|
||||
},
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn supported_prop_names_custom_attr(&self) -> Vec<DOMString> {
|
||||
let element = self.upcast::<Element>();
|
||||
element.attrs().iter().filter_map(|attr| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue