HTMLOptionElement.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2020, the SerenityOS developers.
  3. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <LibWeb/HTML/HTMLElement.h>
  9. namespace Web::HTML {
  10. class HTMLOptionElement final : public HTMLElement {
  11. public:
  12. using WrapperType = Bindings::HTMLOptionElementWrapper;
  13. HTMLOptionElement(DOM::Document&, DOM::QualifiedName);
  14. virtual ~HTMLOptionElement() override;
  15. bool selected() const { return m_selected; }
  16. void set_selected(bool);
  17. String value() const;
  18. void set_value(String);
  19. String text() const;
  20. void set_text(String);
  21. int index() const;
  22. private:
  23. friend class Bindings::OptionConstructor;
  24. friend class HTMLSelectElement;
  25. void parse_attribute(FlyString const& name, String const& value) override;
  26. void did_remove_attribute(FlyString const& name) override;
  27. void ask_for_a_reset();
  28. // https://html.spec.whatwg.org/multipage/form-elements.html#concept-option-selectedness
  29. bool m_selected { false };
  30. // https://html.spec.whatwg.org/multipage/form-elements.html#concept-option-dirtiness
  31. bool m_dirty { false };
  32. };
  33. }