From 4d49c607f844f7c625bb22b018602d694293ec01 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 21 Mar 2022 21:01:47 +0100 Subject: [PATCH] LibWeb: Fix spec transcription mistake in Range.extractContents() The spec text and code didn't match up. Thanks to Tim for spotting this! :^) --- Userland/Libraries/LibWeb/DOM/Range.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/DOM/Range.cpp b/Userland/Libraries/LibWeb/DOM/Range.cpp index 127b0ef659..48e94863d1 100644 --- a/Userland/Libraries/LibWeb/DOM/Range.cpp +++ b/Userland/Libraries/LibWeb/DOM/Range.cpp @@ -671,8 +671,9 @@ ExceptionOr> Range::extract() // 1. Let clone be a clone of original start node. auto clone = original_start_node->clone_node(); - // 2. Set the data of clone to the result of substringing data with node original start node, offset original start offset, and count original start node’s length minus original start offset. - auto result = static_cast(*original_start_node).substring_data(original_start_offset, original_end_offset - original_start_offset); + // 2. Set the data of clone to the result of substringing data with node original start node, offset original start offset, + // and count original start node’s length minus original start offset. + auto result = static_cast(*original_start_node).substring_data(original_start_offset, original_start_node->length() - original_start_offset); if (result.is_exception()) return result.exception(); verify_cast(*clone).set_data(result.release_value());