mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-27 01:50:24 +00:00
LibWeb: Add the HTMLInputElement.type attribute
This makes React react to change events on text <input> elements. :^)
This commit is contained in:
parent
5f54b8dd6c
commit
2660795bcf
Notes:
sideshowbarker
2024-07-17 18:38:01 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/2660795bcf
3 changed files with 19 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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); }
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue