mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
Fixes extend-20.html and extend-00.html
This commit is contained in:
@@ -202,6 +202,13 @@ pub fn extend(self: *Selection, node: *Node, _offset: ?u32, page: *Page) !void {
|
||||
const range = self._range orelse return error.InvalidState;
|
||||
const offset = _offset orelse 0;
|
||||
|
||||
// If the node is not contained in the document, do not change the selection
|
||||
if (!page.document.asNode().contains(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (node._type == .document_type) return error.InvalidNodeType;
|
||||
|
||||
if (offset > node.getLength()) {
|
||||
return error.IndexSizeError;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user