From dee81f354531c2e49be34279ca31ccc7ad9cbcca Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Tue, 27 Aug 2024 10:45:11 +0200 Subject: [PATCH] LibWeb: Compare start container to parent in `Text.splitText()` Tiny mistake in the implementation of the spec; fixes 16 FAILs in the WPT `/dom/ranges/Range-mutations-splitText.html` tests. --- Userland/Libraries/LibWeb/DOM/Text.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/DOM/Text.cpp b/Userland/Libraries/LibWeb/DOM/Text.cpp index 58413a15f92..824a704ebd8 100644 --- a/Userland/Libraries/LibWeb/DOM/Text.cpp +++ b/Userland/Libraries/LibWeb/DOM/Text.cpp @@ -98,7 +98,7 @@ WebIDL::ExceptionOr> Text::split_text(size_t offset) // 4. For each live range whose start node is parent and start offset is equal to the index of node plus 1, increase its start offset by 1. for (auto& range : Range::live_ranges()) { - if (range->start_container() == this && range->start_offset() == index() + 1) + if (range->start_container() == parent.ptr() && range->start_offset() == index() + 1) TRY(range->set_start(*range->start_container(), range->start_offset() + 1)); }