diff --git a/common/content/editor.js b/common/content/editor.js index 34460f49..d1f639b9 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -303,7 +303,6 @@ var Editor = Module("editor", { if (tmpfile && tmpfile.exists()) tmpfile.remove(false); - // blink the textbox after returning if (textBox) { dactyl.focus(textBox); for (let group in values(blink.concat(blink, ""))) { diff --git a/common/content/hints.js b/common/content/hints.js index e22d79a0..9147e27b 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -1012,42 +1012,6 @@ var Hints = Module("hints", { this.hintSession = HintSession(mode, opts); } }, { - - compileMatcher: function compileMatcher(list) { - let xpath = [], css = []; - for (let elem in values(list)) - if (/^xpath:/.test(elem)) - xpath.push(elem.substr(6)); - else - css.push(elem); - - return update( - function matcher(node) { - if (matcher.xpath) - for (let elem in util.evaluateXPath(matcher.xpath, node)) - yield elem; - - if (matcher.css) - for (let [, elem] in iter(node.querySelectorAll(matcher.css))) - yield elem; - }, { - css: css.join(", "), - xpath: xpath.join(" | ") - }); - }, - - validateMatcher: function validateMatcher(values) { - let evaluator = services.XPathEvaluator(); - let node = util.xmlToDom(
, document); - return this.testValues(values, function (value) { - if (/^xpath:/.test(value)) - evaluator.createExpression(value.substr(6), util.evaluateXPath.resolver); - else - node.querySelector(value); - return true; - }); - }, - translitTable: Class.memoize(function () { const table = {}; [ @@ -1218,10 +1182,10 @@ var Hints = Module("hints", { res ? res.matcher : default_, setter: function (vals) { for (let value in values(vals)) - value.matcher = Hints.compileMatcher(Option.splitList(value.result)); + value.matcher = util.compileMatcher(Option.splitList(value.result)); return vals; }, - validator: Hints.validateMatcher + validator: util.validateMatcher }); options.add(["hinttags", "ht"], @@ -1231,10 +1195,10 @@ var Hints = Module("hints", { "[tabindex],[role=link],[role=button]", { setter: function (values) { - this.matcher = Hints.compileMatcher(values); + this.matcher = util.compileMatcher(values); return values; }, - validator: Hints.validateMatcher + validator: util.validateMatcher }); options.add(["hintkeys", "hk"], diff --git a/common/modules/util.jsm b/common/modules/util.jsm index bd30a87a..8675aa24 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -405,6 +405,42 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), return stack.top; }, + compileMatcher: function compileMatcher(list) { + let xpath = [], css = []; + for (let elem in values(list)) + if (/^xpath:/.test(elem)) + xpath.push(elem.substr(6)); + else + css.push(elem); + + return update( + function matcher(node) { + if (matcher.xpath) + for (let elem in util.evaluateXPath(matcher.xpath, node)) + yield elem; + + if (matcher.css) + for (let [, elem] in iter(node.querySelectorAll(matcher.css))) + yield elem; + }, { + css: css.join(", "), + xpath: xpath.join(" | ") + }); + }, + + validateMatcher: function validateMatcher(values) { + let evaluator = services.XPathEvaluator(); + let node = util.xmlToDom(
, document); + return this.testValues(values, function (value) { + if (/^xpath:/.test(value)) + evaluator.createExpression(value.substr(6), util.evaluateXPath.resolver); + else + node.querySelector(value); + return true; + }); + }, + + /** * Returns an object representing a Node's computed CSS style. *