summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKris Maglione <kris@vimperator.org>2010-05-14 18:59:41 -0400
committerKris Maglione <kris@vimperator.org>2010-05-14 18:59:41 -0400
commitb6267c4f19c4f2b2f37626cd666ceb09a818a6d7 (patch)
tree979f57dd3a724ee9438d08af410d73e5e03cf6ae
parent3da3d903a87e9dccbde480ca090e742547608511 (diff)
downloadpentadactyl-b6267c4f19c4f2b2f37626cd666ceb09a818a6d7.tar.gz
Add a docstring to RangeFind class.
--HG-- branch : testing
-rw-r--r--common/content/finder.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/common/content/finder.js b/common/content/finder.js
index 3de2ddf9..6af97a47 100644
--- a/common/content/finder.js
+++ b/common/content/finder.js
@@ -227,6 +227,28 @@ const RangeFinder = Module("rangefinder", {
}
});
+/**
+ * @class RangeFind
+ *
+ * A fairly sophisticated typeahead-find replacement. It supports
+ * incremental search very much as the builtin component.
+ * Additionally, it supports several features impossible to
+ * implement using the standard component. Incremental searching
+ * works both forwards and backwards. Erasing characters during an
+ * incremental search moves the selection back to the first
+ * available match for the shorter term. The selection and viewport
+ * are restored when the search is canceled.
+ *
+ * Also, in addition to full support for frames and iframes, this
+ * implementation will begin searching from the position of the
+ * caret in the last active frame. This is contrary to the behavior
+ * of the builtin component, which always starts a search from the
+ * begining of the first frame in the case of frameset documents,
+ * and cycles through all frames from begining to end. This makes it
+ * impossible to choose the starting point of a search for such
+ * documents, and represents a major detriment to productivity where
+ * large amounts of data are concerned (e.g., for API documents).
+ */
const RangeFind = Class("RangeFind", {
init: function (matchCase, backward, elementPath) {
this.window = Cu.getWeakReference(window);
@@ -485,6 +507,7 @@ const RangeFind = Class("RangeFind", {
parent.insertBefore(node, before);
range.selectNode(node);
}
+
function unhighlight(range) {
let elem = range.startContainer;
while (!(elem instanceof Element) && elem.parentNode)
@@ -512,7 +535,7 @@ const RangeFind = Class("RangeFind", {
else {
this.highlighted = this.lastString;
this.addListeners();
- this.search(null, false);
+ this.search(null, false); // Rehighlight collapsed range
}
},