1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 05:34:12 +01:00

Focus ancestor link (but not input boxes) of rangefinder selections.

--HG--
branch : testing
This commit is contained in:
Kris Maglione
2010-06-10 02:19:35 -04:00
parent 535293a53e
commit 5bd7b6b0fc

View File

@@ -83,6 +83,7 @@ const RangeFinder = Module("rangefinder", {
if (options["hlsearch"])
this.highlight();
this.rangeFind.focus();
},
// Called when the user types a key in the search dialog. Triggers a find attempt if 'incsearch' is set
@@ -103,6 +104,7 @@ const RangeFinder = Module("rangefinder", {
if (options["hlsearch"])
this.highlight();
this.rangeFind.focus();
modes.reset();
},
@@ -311,6 +313,16 @@ const RangeFind = Class("RangeFind", {
}
},
focus: function() {
if(this.lastRange)
var node = util.evaluateXPath(RangeFind.selectNodePath, this.range.document,
this.lastRange.commonAncestorContainer).snapshotItem(0);
if(node) {
node.focus();
this.search(null, false); // Rehighlight collapsed range
}
},
makeFrameList: function (win) {
const self = this;
win = win.top;
@@ -622,6 +634,8 @@ const RangeFind = Class("RangeFind", {
}}
}),
selectNodePath: ["ancestor-or-self::" + s for ([i, s] in Iterator(
["a", "xhtml:a", "*[@onclick]"]))].join(" | "),
endpoint: function (range, before) {
range = range.cloneRange();
range.collapse(before);