Coverage Report

Created: 2025-03-04 07:22

/src/serenity/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2020, the SerenityOS developers.
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#pragma once
8
9
#include <LibWeb/HTML/HTMLElement.h>
10
11
namespace Web::HTML {
12
13
class HTMLBaseElement final : public HTMLElement {
14
    WEB_PLATFORM_OBJECT(HTMLBaseElement, HTMLElement);
15
    JS_DECLARE_ALLOCATOR(HTMLBaseElement);
16
17
public:
18
    virtual ~HTMLBaseElement() override;
19
20
    String href() const;
21
    WebIDL::ExceptionOr<void> set_href(String const& href);
22
23
0
    URL::URL const& frozen_base_url() const { return m_frozen_base_url; }
24
25
    virtual void inserted() override;
26
    virtual void removed_from(Node*) override;
27
    virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
28
29
private:
30
    HTMLBaseElement(DOM::Document&, DOM::QualifiedName);
31
32
    virtual void initialize(JS::Realm&) override;
33
0
    virtual bool is_html_base_element() const override { return true; }
34
35
    // https://html.spec.whatwg.org/multipage/semantics.html#frozen-base-url
36
    // A base element that is the first base element with an href content attribute in a document tree has a frozen base URL.
37
    URL::URL m_frozen_base_url;
38
39
    void set_the_frozen_base_url();
40
};
41
42
}
43
44
namespace Web::DOM {
45
template<>
46
0
inline bool Node::fast_is<HTML::HTMLBaseElement>() const { return is_html_base_element(); }
47
}