2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2019-11-06 20:27:53 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-03-22 19:10:43 +01:00
|
|
|
#include <AK/FlyString.h>
|
2020-09-18 09:49:51 +02:00
|
|
|
#include <LibWeb/DOM/Element.h>
|
2020-03-28 09:12:13 +01:00
|
|
|
#include <LibWeb/DOM/NonElementParentNode.h>
|
2020-03-07 10:32:51 +01:00
|
|
|
#include <LibWeb/DOM/ParentNode.h>
|
2019-11-06 20:27:53 +01:00
|
|
|
|
2020-07-26 19:37:56 +02:00
|
|
|
namespace Web::DOM {
|
2020-03-07 10:27:02 +01:00
|
|
|
|
2020-03-28 09:12:13 +01:00
|
|
|
class DocumentFragment
|
|
|
|
|
: public ParentNode
|
|
|
|
|
, public NonElementParentNode<DocumentFragment> {
|
2019-11-06 20:27:53 +01:00
|
|
|
public:
|
2020-08-19 22:30:33 +01:00
|
|
|
using WrapperType = Bindings::DocumentFragmentWrapper;
|
|
|
|
|
|
2021-09-06 01:07:11 +01:00
|
|
|
static NonnullRefPtr<DocumentFragment> create_with_global_object(Bindings::WindowObject& window);
|
|
|
|
|
|
2020-08-19 22:30:33 +01:00
|
|
|
explicit DocumentFragment(Document& document);
|
2022-03-14 13:21:51 -06:00
|
|
|
virtual ~DocumentFragment() override = default;
|
2019-11-06 20:27:53 +01:00
|
|
|
|
2020-06-16 19:09:14 +02:00
|
|
|
virtual FlyString node_name() const override { return "#document-fragment"; }
|
2020-08-19 22:30:33 +01:00
|
|
|
|
2022-03-14 12:46:14 +01:00
|
|
|
Element* host() { return m_host; }
|
|
|
|
|
Element const* host() const { return m_host; }
|
2020-08-19 22:30:33 +01:00
|
|
|
|
2022-03-16 00:26:40 +01:00
|
|
|
void set_host(Element* host) { m_host = host; }
|
2020-08-19 22:30:33 +01:00
|
|
|
|
|
|
|
|
private:
|
2022-03-14 12:46:14 +01:00
|
|
|
// https://dom.spec.whatwg.org/#concept-documentfragment-host
|
|
|
|
|
WeakPtr<Element> m_host;
|
2019-11-06 20:27:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|