HTMLHeadingElement.h 925 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/ARIA/Roles.h>
  8. #include <LibWeb/HTML/HTMLElement.h>
  9. namespace Web::HTML {
  10. class HTMLHeadingElement final : public HTMLElement {
  11. WEB_PLATFORM_OBJECT(HTMLHeadingElement, HTMLElement);
  12. public:
  13. virtual ~HTMLHeadingElement() override;
  14. virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
  15. // https://www.w3.org/TR/html-aria/#el-h1-h6
  16. virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::heading; }
  17. virtual DeprecatedString aria_level() const override
  18. {
  19. // TODO: aria-level = the number in the element's tag name
  20. return get_attribute("aria-level");
  21. }
  22. private:
  23. HTMLHeadingElement(DOM::Document&, DOM::QualifiedName);
  24. virtual void initialize(JS::Realm&) override;
  25. };
  26. }