2020-08-01 03:05:43 +01:00
|
|
|
/*
|
2021-04-28 22:46:44 +02:00
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
2022-03-20 16:13:23 +01:00
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
2020-08-01 03:05:43 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-08-01 03:05:43 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibWeb/HTML/HTMLElement.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
class HTMLOptionElement final : public HTMLElement {
|
2022-08-28 13:42:07 +02:00
|
|
|
WEB_PLATFORM_OBJECT(HTMLOptionElement, HTMLElement);
|
2020-08-01 03:05:43 +01:00
|
|
|
|
2022-08-28 13:42:07 +02:00
|
|
|
public:
|
2020-08-01 03:05:43 +01:00
|
|
|
virtual ~HTMLOptionElement() override;
|
2022-03-20 16:13:23 +01:00
|
|
|
|
2022-03-20 16:13:58 +01:00
|
|
|
bool selected() const { return m_selected; }
|
|
|
|
void set_selected(bool);
|
|
|
|
|
2022-12-04 18:02:33 +00:00
|
|
|
DeprecatedString value() const;
|
|
|
|
void set_value(DeprecatedString);
|
2022-04-12 13:29:16 -03:00
|
|
|
|
2022-12-04 18:02:33 +00:00
|
|
|
DeprecatedString text() const;
|
|
|
|
void set_text(DeprecatedString);
|
2022-04-12 13:29:16 -03:00
|
|
|
|
|
|
|
int index() const;
|
|
|
|
|
2022-09-30 16:21:34 +01:00
|
|
|
bool disabled() const;
|
|
|
|
|
2023-01-29 19:12:00 +01:00
|
|
|
virtual Optional<DOM::ARIARoles::Role> default_role() const override;
|
2022-11-28 17:58:13 -06:00
|
|
|
|
2022-03-20 16:13:23 +01:00
|
|
|
private:
|
2022-04-03 22:07:03 -03:00
|
|
|
friend class Bindings::OptionConstructor;
|
2022-03-20 16:13:58 +01:00
|
|
|
friend class HTMLSelectElement;
|
|
|
|
|
2022-08-28 13:42:07 +02:00
|
|
|
HTMLOptionElement(DOM::Document&, DOM::QualifiedName);
|
|
|
|
|
2023-01-10 06:28:20 -05:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
|
|
|
2023-01-08 19:23:00 -05:00
|
|
|
void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
|
|
|
|
void did_remove_attribute(DeprecatedFlyString const& name) override;
|
2022-03-20 16:13:58 +01:00
|
|
|
|
|
|
|
void ask_for_a_reset();
|
|
|
|
|
2022-03-20 16:13:23 +01:00
|
|
|
// https://html.spec.whatwg.org/multipage/form-elements.html#concept-option-selectedness
|
|
|
|
bool m_selected { false };
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/form-elements.html#concept-option-dirtiness
|
|
|
|
bool m_dirty { false };
|
2020-08-01 03:05:43 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|