HTMLBaseElement.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2020, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/HTML/HTMLElement.h>
  8. namespace Web::HTML {
  9. class HTMLBaseElement final : public HTMLElement {
  10. public:
  11. using WrapperType = Bindings::HTMLBaseElementWrapper;
  12. HTMLBaseElement(DOM::Document&, DOM::QualifiedName);
  13. virtual ~HTMLBaseElement() override;
  14. String href() const;
  15. void set_href(String const& href);
  16. AK::URL const& frozen_base_url() const { return m_frozen_base_url; }
  17. virtual void inserted() override;
  18. virtual void parse_attribute(FlyString const& name, String const& value) override;
  19. private:
  20. virtual bool is_html_base_element() const override { return true; }
  21. // https://html.spec.whatwg.org/multipage/semantics.html#frozen-base-url
  22. // A base element that is the first base element with an href content attribute in a document tree has a frozen base URL.
  23. AK::URL m_frozen_base_url;
  24. void set_the_frozen_base_url();
  25. };
  26. }
  27. namespace Web::DOM {
  28. template<>
  29. inline bool Node::fast_is<HTML::HTMLBaseElement>() const { return is_html_base_element(); }
  30. }