1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 18:17:44 +00:00

LibWeb: Implement "NodeIterator pre-removing steps"

These steps run when a node is about to be removed from its parent,
and adjust the position of any live NodeIterators so that they don't
point at a now-removed node.

Note that while this commit implements what's in the DOM specification,
the specification doesn't fully match what other browsers do.

Spec bug: https://github.com/whatwg/dom/issues/907
This commit is contained in:
Andreas Kling 2022-03-09 16:38:44 +01:00
parent acbdb95b0a
commit 9c6999ecf2
5 changed files with 91 additions and 2 deletions

View file

@ -19,6 +19,8 @@ class NodeIterator
public:
using WrapperType = Bindings::NodeIteratorWrapper;
virtual ~NodeIterator() override;
static NonnullRefPtr<NodeIterator> create(Node& root, unsigned what_to_show, RefPtr<NodeFilter>);
NonnullRefPtr<Node> root() { return m_root; }
@ -33,6 +35,8 @@ public:
void detach();
void run_pre_removing_steps(Node&);
private:
NodeIterator(Node& root);