diff options
author | Luke Wilde <lukew@serenityos.org> | 2021-09-02 19:27:42 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-02 22:53:19 +0200 |
commit | f7f37eaa0f03a08da15969cb6a43689ebe264e11 (patch) | |
tree | 7a053816e4945107957c1c71e04b86dd088d49fa /Userland/Libraries/LibWeb/DOM/Node.h | |
parent | 7f46022e660614ac9cc9afbcbf07a519ee40ced3 (diff) | |
download | serenity-f7f37eaa0f03a08da15969cb6a43689ebe264e11.zip |
LibWeb: Make Node::root return a reference
The root of a node can never be null, as "the root of an object is
itself, if its parent is null, or else it is the root of its parent."
https://dom.spec.whatwg.org/#concept-tree-root
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM/Node.h')
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Node.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Node.h b/Userland/Libraries/LibWeb/DOM/Node.h index 81a389401f..d0e66209aa 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.h +++ b/Userland/Libraries/LibWeb/DOM/Node.h @@ -113,14 +113,14 @@ public: String child_text_content() const; - Node* root(); - const Node* root() const + Node& root(); + const Node& root() const { return const_cast<Node*>(this)->root(); } - Node* shadow_including_root(); - const Node* shadow_including_root() const + Node& shadow_including_root(); + const Node& shadow_including_root() const { return const_cast<Node*>(this)->shadow_including_root(); } |