aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlelement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r--components/script/dom/htmlelement.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs
index d0f3f35d0ab..8c718c5ab29 100644
--- a/components/script/dom/htmlelement.rs
+++ b/components/script/dom/htmlelement.rs
@@ -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| {