HTMLAnchorElement.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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/HTML/HTMLElement.h>
  8. #include <LibWeb/HTML/HTMLHyperlinkElementUtils.h>
  9. namespace Web::HTML {
  10. class HTMLAnchorElement final
  11. : public HTMLElement
  12. , public HTMLHyperlinkElementUtils {
  13. public:
  14. using WrapperType = Bindings::HTMLAnchorElementWrapper;
  15. HTMLAnchorElement(DOM::Document&, DOM::QualifiedName);
  16. virtual ~HTMLAnchorElement() override;
  17. String target() const { return attribute(HTML::AttributeNames::target); }
  18. virtual bool is_focusable() const override { return has_attribute(HTML::AttributeNames::href); }
  19. virtual bool is_html_anchor_element() const override { return true; }
  20. private:
  21. // ^DOM::Element
  22. virtual void parse_attribute(FlyString const& name, String const& value) override;
  23. // ^HTML::HTMLHyperlinkElementUtils
  24. virtual DOM::Document const& hyperlink_element_utils_document() const override { return document(); }
  25. virtual String hyperlink_element_utils_href() const override;
  26. virtual void set_hyperlink_element_utils_href(String) override;
  27. };
  28. }
  29. namespace Web::DOM {
  30. template<>
  31. inline bool Node::fast_is<HTML::HTMLAnchorElement>() const { return is_html_anchor_element(); }
  32. }