Coverage Report

Created: 2025-08-28 06:26

/src/serenity/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2020-2021, Luke Wilde <lukew@serenityos.org>
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#include <LibWeb/Bindings/DocumentFragmentPrototype.h>
8
#include <LibWeb/DOM/DocumentFragment.h>
9
#include <LibWeb/HTML/Window.h>
10
11
namespace Web::DOM {
12
13
JS_DEFINE_ALLOCATOR(DocumentFragment);
14
15
DocumentFragment::DocumentFragment(Document& document)
16
0
    : ParentNode(document, NodeType::DOCUMENT_FRAGMENT_NODE)
17
0
{
18
0
}
19
20
void DocumentFragment::initialize(JS::Realm& realm)
21
0
{
22
0
    Base::initialize(realm);
23
0
    WEB_SET_PROTOTYPE_FOR_INTERFACE(DocumentFragment);
24
0
}
25
26
void DocumentFragment::visit_edges(Cell::Visitor& visitor)
27
0
{
28
0
    Base::visit_edges(visitor);
29
0
    visitor.visit(m_host);
30
0
}
31
32
void DocumentFragment::set_host(Web::DOM::Element* element)
33
0
{
34
0
    m_host = element;
35
0
}
36
37
// https://dom.spec.whatwg.org/#dom-documentfragment-documentfragment
38
WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentFragment>> DocumentFragment::construct_impl(JS::Realm& realm)
39
0
{
40
0
    auto& window = verify_cast<HTML::Window>(realm.global_object());
41
0
    return realm.heap().allocate<DocumentFragment>(realm, window.associated_document());
42
0
}
43
44
}