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);
|
|
|
|
|
2022-04-12 19:29:16 +03:00
|
|
|
String value() const;
|
|
|
|
void set_value(String);
|
|
|
|
|
|
|
|
String text() const;
|
|
|
|
void set_text(String);
|
|
|
|
|
|
|
|
int index() const;
|
|
|
|
|
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);
|
|
|
|
|
2022-03-20 18:13:58 +03:00
|
|
|
void parse_attribute(FlyString const& name, String const& value) override;
|
|
|
|
void did_remove_attribute(FlyString const& name) override;
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
}
|