2020-08-01 05:05:43 +03:00
|
|
|
/*
|
2021-04-28 23:46:44 +03:00
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
2022-03-20 18:13:23 +03:00
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
2020-08-01 05:05:43 +03:00
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-08-01 05:05:43 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibWeb/HTML/HTMLElement.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
class HTMLOptionElement final : public HTMLElement {
|
2022-08-28 14:42:07 +03:00
|
|
|
WEB_PLATFORM_OBJECT(HTMLOptionElement, HTMLElement);
|
2020-08-01 05:05:43 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
public:
|
2020-08-01 05:05:43 +03:00
|
|
|
virtual ~HTMLOptionElement() override;
|
2022-03-20 18:13:23 +03:00
|
|
|
|
2022-03-20 18:13:58 +03:00
|
|
|
bool selected() const { return m_selected; }
|
|
|
|
void set_selected(bool);
|
|
|
|
|
2023-09-03 06:51:13 +03:00
|
|
|
String value() const;
|
|
|
|
WebIDL::ExceptionOr<void> set_value(String const&);
|
2022-04-12 19:29:16 +03:00
|
|
|
|
2023-09-03 06:51:13 +03:00
|
|
|
String text() const;
|
|
|
|
void set_text(String const&);
|
2022-04-12 19:29:16 +03:00
|
|
|
|
|
|
|
int index() const;
|
|
|
|
|
2022-09-30 18:21:34 +03:00
|
|
|
bool disabled() const;
|
|
|
|
|
2023-01-29 01:23:16 +03:00
|
|
|
virtual Optional<ARIA::Role> default_role() const override;
|
2022-11-29 02:58:13 +03:00
|
|
|
|
2022-03-20 18:13:23 +03:00
|
|
|
private:
|
2022-04-04 04:07:03 +03:00
|
|
|
friend class Bindings::OptionConstructor;
|
2022-03-20 18:13:58 +03:00
|
|
|
friend class HTMLSelectElement;
|
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
HTMLOptionElement(DOM::Document&, DOM::QualifiedName);
|
|
|
|
|
2023-08-07 09:41:28 +03:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2023-01-10 14:28:20 +03:00
|
|
|
|
2023-10-10 14:30:58 +03:00
|
|
|
void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value) override;
|
2022-03-20 18:13:58 +03:00
|
|
|
|
|
|
|
void ask_for_a_reset();
|
|
|
|
|
2022-03-20 18:13:23 +03: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 05:05:43 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|