mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:27:45 +00:00
LibWeb: Implement HTMLSelectElement.type
This commit is contained in:
parent
c247fefee7
commit
c4ee43c5b4
3 changed files with 17 additions and 0 deletions
|
@ -129,4 +129,17 @@ i32 HTMLSelectElement::default_tab_index_value() const
|
||||||
return 0;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,8 @@ public:
|
||||||
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
||||||
virtual bool is_labelable() const override { return true; }
|
virtual bool is_labelable() const override { return true; }
|
||||||
|
|
||||||
|
String const& type() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLSelectElement(DOM::Document&, DOM::QualifiedName);
|
HTMLSelectElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ interface HTMLSelectElement : HTMLElement {
|
||||||
[Reflect] attribute boolean required;
|
[Reflect] attribute boolean required;
|
||||||
[SameObject] readonly attribute HTMLOptionsCollection options;
|
[SameObject] readonly attribute HTMLOptionsCollection options;
|
||||||
|
|
||||||
|
readonly attribute DOMString type;
|
||||||
|
|
||||||
readonly attribute unsigned long length;
|
readonly attribute unsigned long length;
|
||||||
getter Element? item(unsigned long index);
|
getter Element? item(unsigned long index);
|
||||||
getter Element? namedItem(DOMString name);
|
getter Element? namedItem(DOMString name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue