diff options
author | Luke Wilde <lukew@serenityos.org> | 2022-11-05 04:51:42 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-11-07 14:10:41 +0100 |
commit | c4ee43c5b41770ef69402269c6efa92ad5ded2be (patch) | |
tree | 3c311f059a7d93411534e2489e016c31b84e6a4b /Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp | |
parent | c247fefee72201732a579dcbd5c414a84bfbc350 (diff) | |
download | serenity-c4ee43c5b41770ef69402269c6efa92ad5ded2be.zip |
LibWeb: Implement HTMLSelectElement.type
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp index 73dc93c6f3..f5e8845e54 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp @@ -129,4 +129,17 @@ i32 HTMLSelectElement::default_tab_index_value() const return 0; } +// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-type +String const& HTMLSelectElement::type() const +{ + // The type IDL attribute, on getting, must return the string "select-one" if the multiple attribute is absent, and the string "select-multiple" if the multiple attribute is present. + static String select_one = "select-one"sv; + static String select_multiple = "select-multiple"sv; + + if (!has_attribute(AttributeNames::multiple)) + return select_one; + + return select_multiple; +} + } |