diff options
-rw-r--r-- | common/content/finder.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/content/finder.js b/common/content/finder.js index 2cd391b4..3322f12c 100644 --- a/common/content/finder.js +++ b/common/content/finder.js @@ -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); |