diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index cd8eebeac9..49125b36a4 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -238,6 +239,14 @@ void Node::set_node_value(DeprecatedString const& value) // Otherwise, do nothing. } +// https://html.spec.whatwg.org/multipage/document-sequences.html#node-navigable +JS::GCPtr Node::navigable() const +{ + // To get the node navigable of a node node, return the navigable whose active document is node's node document, + // or null if there is no such navigable. + return HTML::Navigable::navigable_with_active_document(const_cast(document())); +} + void Node::invalidate_style() { if (is_document()) { diff --git a/Userland/Libraries/LibWeb/DOM/Node.h b/Userland/Libraries/LibWeb/DOM/Node.h index 4685402fff..6fe2a5c2de 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.h +++ b/Userland/Libraries/LibWeb/DOM/Node.h @@ -135,6 +135,8 @@ public: DeprecatedString node_value() const; void set_node_value(DeprecatedString const&); + JS::GCPtr navigable() const; + Document& document() { return *m_document; } Document const& document() const { return *m_document; }