diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index db2fcc2233..2730a47223 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -768,4 +768,10 @@ void Node::string_replace_all(String const& string) replace_all(node); } +// https://dom.spec.whatwg.org/#dom-node-issamenode +bool Node::is_same_node(Node const* other_node) const +{ + return this == other_node; +} + } diff --git a/Userland/Libraries/LibWeb/DOM/Node.h b/Userland/Libraries/LibWeb/DOM/Node.h index 9287a97430..eb2f6747f1 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.h +++ b/Userland/Libraries/LibWeb/DOM/Node.h @@ -186,6 +186,8 @@ public: void replace_all(RefPtr); void string_replace_all(String const&); + bool is_same_node(Node const*) const; + protected: Node(Document&, NodeType); diff --git a/Userland/Libraries/LibWeb/DOM/Node.idl b/Userland/Libraries/LibWeb/DOM/Node.idl index 603095e5ed..419793432f 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.idl +++ b/Userland/Libraries/LibWeb/DOM/Node.idl @@ -26,6 +26,7 @@ interface Node : EventTarget { [ImplementedAs=pre_remove] Node removeChild(Node child); [ImplementedAs=clone_node_binding] Node cloneNode(optional boolean deep = false); boolean contains(Node? other); + boolean isSameNode(Node? otherNode); const unsigned short ELEMENT_NODE = 1; const unsigned short ATTRIBUTE_NODE = 2;