diff options
author | Kris Maglione <kris@vimperator.org> | 2010-06-10 02:19:35 -0400 |
---|---|---|
committer | Kris Maglione <kris@vimperator.org> | 2010-06-10 02:19:35 -0400 |
commit | 5bd7b6b0fc695d216af787d6ab1b5abb86d090b6 (patch) | |
tree | 7351c892a26d082d4f4e895dfae8949d345543d9 | |
parent | 535293a53eb672dc31108f4d45e2c0e395ab68a5 (diff) | |
download | pentadactyl-5bd7b6b0fc695d216af787d6ab1b5abb86d090b6.tar.gz |
Focus ancestor link (but not input boxes) of rangefinder selections.
--HG--
branch : testing
-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); |