MathMLElement.cpp 924 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) 2023, Jonah Shafran <jonahshafran@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Bindings/ExceptionOrUtils.h>
  7. #include <LibWeb/MathML/MathMLElement.h>
  8. #include <LibWeb/MathML/TagNames.h>
  9. namespace Web::MathML {
  10. MathMLElement::~MathMLElement() = default;
  11. MathMLElement::MathMLElement(DOM::Document& document, DOM::QualifiedName qualified_name)
  12. : DOM::Element(document, move(qualified_name))
  13. {
  14. }
  15. void MathMLElement::initialize(JS::Realm& realm)
  16. {
  17. Base::initialize(realm);
  18. set_prototype(&Bindings::ensure_web_prototype<Bindings::MathMLElementPrototype>(realm, "MathMLElement"));
  19. m_dataset = HTML::DOMStringMap::create(*this);
  20. }
  21. Optional<ARIA::Role> MathMLElement::default_role() const
  22. {
  23. // https://www.w3.org/TR/html-aria/#el-math
  24. if (local_name() == TagNames::math.to_deprecated_fly_string())
  25. return ARIA::Role::math;
  26. return {};
  27. }
  28. }