1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-28 22:32:27 +01:00

Make sure selection is not null after buffer.resetCaret.

This commit is contained in:
Kris Maglione
2011-10-05 04:16:34 -04:00
parent 5aa365b7a9
commit b9ecc8a1f0

View File

@@ -499,6 +499,7 @@ var Buffer = Module("Buffer", {
}
let win = this.focusedFrame;
let doc = win.document;
let sel = win.getSelection();
let { viewport } = DOM(win);
@@ -528,6 +529,8 @@ var Buffer = Module("Buffer", {
let ranges = getRanges(rect);
if (!ranges.length)
ranges = getRanges({ x: 0, y: y, width: win.innerWidth, height: 0 });
if (!ranges.length && !sel.rangeCount)
ranges = [RangeFind.nodeContents(doc.body || doc.querySelector("body") || doc.documentElement)];
if (!ranges.length)
return;