LibWeb: Fix spec transcription mistake in Range.extractContents()

The spec text and code didn't match up.

Thanks to Tim for spotting this! :^)
This commit is contained in:
Andreas Kling 2022-03-21 21:01:47 +01:00
parent ac8a8459d0
commit 4d49c607f8
Notes: sideshowbarker 2024-07-17 16:59:07 +09:00

View File

@ -671,8 +671,9 @@ ExceptionOr<NonnullRefPtr<DocumentFragment>> 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 nodes length minus original start offset.
auto result = static_cast<CharacterData const&>(*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 nodes length minus original start offset.
auto result = static_cast<CharacterData const&>(*original_start_node).substring_data(original_start_offset, original_start_node->length() - original_start_offset);
if (result.is_exception())
return result.exception();
verify_cast<CharacterData>(*clone).set_data(result.release_value());