2020-08-17 19:14:30 +01:00
|
|
|
/*
|
2021-09-06 01:07:11 +01:00
|
|
|
* Copyright (c) 2020-2021, Luke Wilde <lukew@serenityos.org>
|
2020-08-17 19:14:30 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-08-17 19:14:30 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/DOM/DocumentFragment.h>
|
2022-03-07 23:08:26 +01:00
|
|
|
#include <LibWeb/HTML/Window.h>
|
2020-08-17 19:14:30 +01:00
|
|
|
|
|
|
|
|
namespace Web::DOM {
|
|
|
|
|
|
|
|
|
|
DocumentFragment::DocumentFragment(Document& document)
|
|
|
|
|
: ParentNode(document, NodeType::DOCUMENT_FRAGMENT_NODE)
|
|
|
|
|
{
|
2022-09-03 18:43:24 +02:00
|
|
|
set_prototype(&window().cached_web_prototype("DocumentFragment"));
|
2022-08-28 13:42:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DocumentFragment::visit_edges(Cell::Visitor& visitor)
|
|
|
|
|
{
|
|
|
|
|
Base::visit_edges(visitor);
|
|
|
|
|
visitor.visit(m_host.ptr());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DocumentFragment::set_host(Web::DOM::Element* element)
|
|
|
|
|
{
|
|
|
|
|
m_host = element;
|
2020-08-17 19:14:30 +01:00
|
|
|
}
|
|
|
|
|
|
2021-09-06 01:07:11 +01:00
|
|
|
// https://dom.spec.whatwg.org/#dom-documentfragment-documentfragment
|
2022-08-28 13:42:07 +02:00
|
|
|
JS::NonnullGCPtr<DocumentFragment> DocumentFragment::create_with_global_object(HTML::Window& window)
|
2021-09-06 01:07:11 +01:00
|
|
|
{
|
2022-08-28 13:42:07 +02:00
|
|
|
return *window.heap().allocate<DocumentFragment>(window.realm(), window.associated_document());
|
2021-09-06 01:07:11 +01:00
|
|
|
}
|
|
|
|
|
|
2020-08-17 19:14:30 +01:00
|
|
|
}
|