diff --git a/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.h b/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.h
index cf373f98d7..07ec1629c6 100644
--- a/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.h
+++ b/Userland/Libraries/LibWeb/HTML/FormAssociatedElement.h
@@ -21,6 +21,18 @@ public:
bool enabled() const;
+ // https://html.spec.whatwg.org/multipage/forms.html#category-listed
+ virtual bool is_listed() const { return false; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-submit
+ virtual bool is_submittable() const { return false; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-reset
+ virtual bool is_resettable() const { return false; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
+ virtual bool is_auto_capitalize_inheriting() const { return false; }
+
protected:
FormAssociatedElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: HTMLElement(document, move(qualified_name))
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h
index 6c4723c9a2..dd6fbff687 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h
@@ -16,6 +16,20 @@ public:
HTMLButtonElement(DOM::Document&, DOM::QualifiedName);
virtual ~HTMLButtonElement() override;
+
+ // ^FormAssociatedElement
+ // https://html.spec.whatwg.org/multipage/forms.html#category-listed
+ virtual bool is_listed() const override { return true; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-submit
+ virtual bool is_submittable() const override { return true; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
+ virtual bool is_auto_capitalize_inheriting() const override { return true; }
+
+ // ^HTMLElement
+ // https://html.spec.whatwg.org/multipage/forms.html#category-label
+ virtual bool is_labelable() const override { return true; }
};
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.h b/Userland/Libraries/LibWeb/HTML/HTMLElement.h
index 9e925b2b59..1674a906c0 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.h
@@ -46,6 +46,9 @@ public:
bool fire_a_synthetic_pointer_event(FlyString const& type, DOM::Element& target, bool not_trusted);
+ // https://html.spec.whatwg.org/multipage/forms.html#category-label
+ virtual bool is_labelable() const { return false; }
+
protected:
virtual void parse_attribute(const FlyString& name, const String& value) override;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h
index f9295cab59..c0b5fe9389 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h
@@ -22,6 +22,13 @@ public:
static String fieldset = "fieldset";
return fieldset;
}
+
+ // ^FormAssociatedElement
+ // https://html.spec.whatwg.org/multipage/forms.html#category-listed
+ virtual bool is_listed() const override { return true; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
+ virtual bool is_auto_capitalize_inheriting() const override { return true; }
};
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
index 45ad02cba0..140310d2cc 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
@@ -83,6 +83,23 @@ public:
virtual void parse_attribute(FlyString const&, String const&) override;
virtual void did_remove_attribute(FlyString const&) override;
+ // ^FormAssociatedElement
+ // https://html.spec.whatwg.org/multipage/forms.html#category-listed
+ virtual bool is_listed() const override { return true; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-submit
+ virtual bool is_submittable() const override { return true; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-reset
+ virtual bool is_resettable() const override { return true; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
+ virtual bool is_auto_capitalize_inheriting() const override { return true; }
+
+ // ^HTMLElement
+ // https://html.spec.whatwg.org/multipage/forms.html#category-label
+ virtual bool is_labelable() const override { return type_state() != TypeAttributeState::Hidden; }
+
private:
// ^DOM::Node
virtual void inserted() override;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h
index bdd8294f7b..7877ea7f58 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, the SerenityOS developers.
+ * Copyright (c) 2022, Luke Wilde
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -16,6 +17,10 @@ public:
HTMLMeterElement(DOM::Document&, DOM::QualifiedName);
virtual ~HTMLMeterElement() override;
+
+ // ^HTMLElement
+ // https://html.spec.whatwg.org/multipage/forms.html#category-label
+ virtual bool is_labelable() const override { return true; }
};
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h
index f4c51506bf..7604ecfa3d 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h
@@ -25,6 +25,10 @@ public:
String data() const { return attribute(HTML::AttributeNames::data); }
String type() const { return attribute(HTML::AttributeNames::type); }
+ // ^FormAssociatedElement
+ // https://html.spec.whatwg.org/multipage/forms.html#category-listed
+ virtual bool is_listed() const override { return true; }
+
private:
virtual RefPtr create_layout_node(NonnullRefPtr) override;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h
index 0c27e18f56..d2662d877a 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, the SerenityOS developers.
+ * Copyright (c) 2022, Luke Wilde
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -22,6 +23,20 @@ public:
static String output = "output";
return output;
}
+
+ // ^FormAssociatedElement
+ // https://html.spec.whatwg.org/multipage/forms.html#category-listed
+ virtual bool is_listed() const override { return true; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
+ virtual bool is_resettable() const override { return true; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
+ virtual bool is_auto_capitalize_inheriting() const override { return true; }
+
+ // ^HTMLElement
+ // https://html.spec.whatwg.org/multipage/forms.html#category-label
+ virtual bool is_labelable() const override { return true; }
};
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h
index 058e8f227e..76540e23cc 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h
@@ -27,6 +27,10 @@ public:
double position() const;
+ // ^HTMLElement
+ // https://html.spec.whatwg.org/multipage/forms.html#category-label
+ virtual bool is_labelable() const override { return true; }
+
private:
bool is_determinate() const { return has_attribute(HTML::AttributeNames::value); }
};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h
index f58bb1e3ba..b6425b3dd3 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2020, the SerenityOS developers.
* Copyright (c) 2021, Andreas Kling
+ * Copyright (c) 2022, Luke Wilde
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -19,6 +20,23 @@ public:
HTMLSelectElement(DOM::Document&, DOM::QualifiedName);
virtual ~HTMLSelectElement() override;
+ // ^FormAssociatedElement
+ // https://html.spec.whatwg.org/multipage/forms.html#category-listed
+ virtual bool is_listed() const override { return true; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-submit
+ virtual bool is_submittable() const override { return true; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-reset
+ virtual bool is_resettable() const override { return true; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
+ virtual bool is_auto_capitalize_inheriting() const override { return true; }
+
+ // ^HTMLElement
+ // https://html.spec.whatwg.org/multipage/forms.html#category-label
+ virtual bool is_labelable() const override { return true; }
+
private:
// ^DOM::Node
virtual void inserted() override;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h
index 43ced3c117..376d0def13 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, the SerenityOS developers.
+ * Copyright (c) 2022, Luke Wilde
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -22,6 +23,23 @@ public:
static String textarea = "textarea";
return textarea;
}
+
+ // ^FormAssociatedElement
+ // https://html.spec.whatwg.org/multipage/forms.html#category-listed
+ virtual bool is_listed() const override { return true; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-submit
+ virtual bool is_submittable() const override { return true; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-reset
+ virtual bool is_resettable() const override { return true; }
+
+ // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
+ virtual bool is_auto_capitalize_inheriting() const override { return true; }
+
+ // ^HTMLElement
+ // https://html.spec.whatwg.org/multipage/forms.html#category-label
+ virtual bool is_labelable() const override { return true; }
};
}