diff options
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp | 14 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLInputElement.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLInputElement.idl | 2 |
3 files changed, 19 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 4935f8d3d3..26769cd652 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -219,4 +219,18 @@ void HTMLInputElement::did_remove_attribute(FlyString const& name) } } +String HTMLInputElement::type() const +{ + // FIXME: This should only reflect known values. + auto value = attribute(HTML::AttributeNames::type); + if (value.is_null()) + return "text"; + return value; +} + +void HTMLInputElement::set_type(String const& type) +{ + set_attribute(HTML::AttributeNames::type, type); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h index 7a5265ac05..2a96aceb66 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h @@ -20,7 +20,9 @@ public: virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override; - String type() const { return attribute(HTML::AttributeNames::type); } + String type() const; + void set_type(String const&); + String default_value() const { return attribute(HTML::AttributeNames::value); } String name() const { return attribute(HTML::AttributeNames::name); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.idl index b8ed3705df..e4f1b9083c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.idl +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.idl @@ -17,6 +17,8 @@ interface HTMLInputElement : HTMLElement { [Reflect=dirname] attribute DOMString dirName; [Reflect=value] attribute DOMString defaultValue; + attribute DOMString type; + [LegacyNullToEmptyString] attribute DOMString value; attribute boolean checked; |