Skip to content

Commit

Permalink
LibWeb: Compare start container to parent in Text.splitText()
Browse files Browse the repository at this point in the history
Tiny mistake in the implementation of the spec; fixes 16 FAILs in the
WPT `/dom/ranges/Range-mutations-splitText.html` tests.
  • Loading branch information
gmta committed Aug 27, 2024
1 parent 730ec6a commit 68abdf5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Userland/Libraries/LibWeb/DOM/Text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Text>> 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));
}

Expand Down

0 comments on commit 68abdf5

Please sign in to comment.