Files
ladybird/Tests/LibWeb/Screenshot/input/selection-partial-nodes.html
Psychpsyo 80b629578e LibWeb: Fix partially selecting non-text nodes
Steps 4 and 5 were swapped since marking all the nodes between the start
and end of the selection now also marks the end node as full, even if it
should be marked as End.
There could be extra logic to avoid marking it if it is a text node, but
this seems easier.

As a whole, this fixes partially selected non-text nodes. In such cases,
where the selection starts or ends inside a node with descendants, it is
impossible to just select from the start node to the end node since that
would select all descendants of the start node and none of the end node.
Previously, this was only half considered and only if the start node was
a descendant of the end node.
2025-10-21 10:23:10 +01:00

11 lines
414 B
HTML

<!DOCTYPE html>
<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-250">
<link rel="match" href="../expected/selection-partial-nodes-ref.html" />
<div id="start">not selected <span>sel</span><span id="end">ected<span> and not selected</span></span></div>
<script>
let range = document.createRange();
range.setStart(start, 1);
range.setEnd(end, 1);
window.getSelection().addRange(range);
</script>