2020-01-18 11:38:21 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 11:38:21 +03:00
|
|
|
*/
|
|
|
|
|
2019-11-06 22:27:53 +03:00
|
|
|
#pragma once
|
|
|
|
|
2020-03-22 21:10:43 +03:00
|
|
|
#include <AK/FlyString.h>
|
2020-09-18 10:49:51 +03:00
|
|
|
#include <LibWeb/DOM/Element.h>
|
2020-03-28 11:12:13 +03:00
|
|
|
#include <LibWeb/DOM/NonElementParentNode.h>
|
2020-03-07 12:32:51 +03:00
|
|
|
#include <LibWeb/DOM/ParentNode.h>
|
2019-11-06 22:27:53 +03:00
|
|
|
|
2020-07-26 20:37:56 +03:00
|
|
|
namespace Web::DOM {
|
2020-03-07 12:27:02 +03:00
|
|
|
|
2020-03-28 11:12:13 +03:00
|
|
|
class DocumentFragment
|
|
|
|
: public ParentNode
|
|
|
|
, public NonElementParentNode<DocumentFragment> {
|
2022-08-28 14:42:07 +03:00
|
|
|
WEB_PLATFORM_OBJECT(DocumentFragment, ParentNode);
|
2020-08-20 00:30:33 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
public:
|
2022-09-26 01:15:49 +03:00
|
|
|
static JS::NonnullGCPtr<DocumentFragment> construct_impl(JS::Realm& realm);
|
2021-09-06 03:07:11 +03:00
|
|
|
|
2022-03-14 22:21:51 +03:00
|
|
|
virtual ~DocumentFragment() override = default;
|
2019-11-06 22:27:53 +03:00
|
|
|
|
2020-06-16 20:09:14 +03:00
|
|
|
virtual FlyString node_name() const override { return "#document-fragment"; }
|
2020-08-20 00:30:33 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
Element* host() { return m_host.ptr(); }
|
|
|
|
Element const* host() const { return m_host.ptr(); }
|
2020-08-20 00:30:33 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
void set_host(Element*);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
explicit DocumentFragment(Document& document);
|
|
|
|
|
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
2020-08-20 00:30:33 +03:00
|
|
|
|
|
|
|
private:
|
2022-03-14 14:46:14 +03:00
|
|
|
// https://dom.spec.whatwg.org/#concept-documentfragment-host
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::GCPtr<Element> m_host;
|
2019-11-06 22:27:53 +03:00
|
|
|
};
|
|
|
|
|
2022-03-30 00:28:17 +03:00
|
|
|
template<>
|
|
|
|
inline bool Node::fast_is<DocumentFragment>() const { return is_document_fragment(); }
|
|
|
|
|
2019-11-06 22:27:53 +03:00
|
|
|
}
|