HTMLOrSVGElement.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibGC/Ptr.h>
  8. #include <LibJS/Heap/Cell.h>
  9. #include <LibWeb/HTML/DOMStringMap.h>
  10. namespace Web::HTML {
  11. template<typename ElementBase>
  12. class HTMLOrSVGElement {
  13. public:
  14. [[nodiscard]] GC::Ref<DOMStringMap> dataset();
  15. // https://html.spec.whatwg.org/#dom-noncedelement-nonce
  16. String const& nonce() { return m_cryptographic_nonce; }
  17. void set_nonce(String const& nonce) { m_cryptographic_nonce = nonce; }
  18. void focus();
  19. void blur();
  20. protected:
  21. void attribute_changed(FlyString const&, Optional<String> const&, Optional<String> const&, Optional<FlyString> const&);
  22. WebIDL::ExceptionOr<void> cloned(DOM::Node&, bool);
  23. void inserted();
  24. void visit_edges(JS::Cell::Visitor&);
  25. // https://html.spec.whatwg.org/multipage/dom.html#dom-dataset-dev
  26. GC::Ptr<DOMStringMap> m_dataset;
  27. // https://html.spec.whatwg.org/#cryptographicnonce
  28. String m_cryptographic_nonce;
  29. // https://html.spec.whatwg.org/multipage/interaction.html#locked-for-focus
  30. bool m_locked_for_focus { false };
  31. };
  32. }