2022-07-11 16:37:51 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-09-01 17:13:18 +02:00
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
2022-07-11 16:37:51 +01:00
|
|
|
|
|
|
|
namespace Web::DOM {
|
|
|
|
|
|
|
|
// https://dom.spec.whatwg.org/#mutationrecord
|
2022-09-01 17:13:18 +02:00
|
|
|
class MutationRecord : public Bindings::PlatformObject {
|
|
|
|
WEB_PLATFORM_OBJECT(MutationRecord, Bindings::PlatformObject);
|
2022-07-11 16:37:51 +01:00
|
|
|
|
2022-09-01 17:13:18 +02:00
|
|
|
public:
|
2023-02-25 10:44:51 -07:00
|
|
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MutationRecord>> create(JS::Realm&, DeprecatedFlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value);
|
2022-09-01 17:13:18 +02:00
|
|
|
|
|
|
|
virtual ~MutationRecord() override;
|
|
|
|
|
2023-01-08 19:23:00 -05:00
|
|
|
DeprecatedFlyString const& type() const { return m_type; }
|
2022-09-01 17:13:18 +02:00
|
|
|
Node const* target() const { return m_target; }
|
|
|
|
NodeList const* added_nodes() const { return m_added_nodes; }
|
|
|
|
NodeList const* removed_nodes() const { return m_removed_nodes; }
|
|
|
|
Node const* previous_sibling() const { return m_previous_sibling; }
|
|
|
|
Node const* next_sibling() const { return m_next_sibling; }
|
2022-12-04 18:02:33 +00:00
|
|
|
DeprecatedString const& attribute_name() const { return m_attribute_name; }
|
|
|
|
DeprecatedString const& attribute_namespace() const { return m_attribute_namespace; }
|
|
|
|
DeprecatedString const& old_value() const { return m_old_value; }
|
2022-09-01 17:13:18 +02:00
|
|
|
|
|
|
|
private:
|
2023-02-25 10:44:51 -07:00
|
|
|
MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type, Node const& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value);
|
2023-01-10 06:28:20 -05:00
|
|
|
|
2023-01-28 12:33:35 -05:00
|
|
|
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
2022-09-01 17:13:18 +02:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
2023-01-08 19:23:00 -05:00
|
|
|
DeprecatedFlyString m_type;
|
2023-02-25 10:44:51 -07:00
|
|
|
JS::GCPtr<Node const> m_target;
|
2022-09-01 17:13:18 +02:00
|
|
|
JS::GCPtr<NodeList> m_added_nodes;
|
|
|
|
JS::GCPtr<NodeList> m_removed_nodes;
|
|
|
|
JS::GCPtr<Node> m_previous_sibling;
|
|
|
|
JS::GCPtr<Node> m_next_sibling;
|
2022-12-04 18:02:33 +00:00
|
|
|
DeprecatedString m_attribute_name;
|
|
|
|
DeprecatedString m_attribute_namespace;
|
|
|
|
DeprecatedString m_old_value;
|
2022-07-11 16:37:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|