1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-14 18:45:48 +01:00

Closes issue #667.

This commit is contained in:
Kris Maglione
2011-09-28 04:05:55 -04:00
parent 43421e8631
commit 2b52b7ee2d
2 changed files with 10 additions and 8 deletions

View File

@@ -2161,7 +2161,9 @@ var Buffer = Module("buffer", {
"code.google.com": '#nums [id^="nums_table"] a[href^="#"]', "code.google.com": '#nums [id^="nums_table"] a[href^="#"]',
"github.com": '.line_numbers>*', "github.com": '.line_numbers>*',
"mxr.mozilla.org": 'a.l', "mxr.mozilla.org": 'a.l',
"pastebin.com": '#code_frame>div>ol>li' "pastebin.com": '#code_frame>div>ol>li',
"addons.mozilla.org": '.gutter>.line>a',
"*": '/* Hgweb/Gitweb */ .completecodeline a.codeline, a.linenr'
}, },
{ {
getLine: function getLine(doc, line) { getLine: function getLine(doc, line) {
@@ -2191,12 +2193,12 @@ var Buffer = Module("buffer", {
return vals; return vals;
}, },
validate: function validate(values) { validator: function validate(values) {
return this.testValues(values, function (value) { return this.testValues(values, function (value) {
if (/^func:/.test(value)) if (/^func:/.test(value))
return callable(dactyl.userEval("(" + Option.dequote(value.substr(5)) + ")")); return callable(dactyl.userEval("(" + Option.dequote(value.substr(5)) + ")"));
else else
return DOM.testMatcher(value); return DOM.testMatcher(Option.dequote(value));
}); });
} }
}); });

View File

@@ -1347,16 +1347,16 @@ var DOM = Class("DOM", {
* @returns {boolean} True when the patterns are all valid. * @returns {boolean} True when the patterns are all valid.
*/ */
validateMatcher: function validateMatcher(list) { validateMatcher: function validateMatcher(list) {
let evaluator = services.XPathEvaluator(); return this.testValues(list, DOM.closure.testMatcher);
let node = services.XMLDocument();
return this.testValues(list, this.closure.testMatcher);
}, },
testMatcher: function testMatcher(value) { testMatcher: function testMatcher(value) {
let evaluator = services.XPathEvaluator();
let node = services.XMLDocument();
if (/^xpath:/.test(value)) if (/^xpath:/.test(value))
evaluator.createExpression(value.substr(6), DOM.XPath.resolver); util.withProperErrors("createExpression", evaluator, value.substr(6), DOM.XPath.resolver);
else else
node.querySelector(value); util.withProperErrors("querySelector", node, value);
return true; return true;
}, },