diff --git a/common/content/hints.js b/common/content/hints.js index 9538f4fe..ecbfd8b2 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -693,6 +693,18 @@ function compileMatcher(list) { }); } +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; + }); +} + var Hints = Module("hints", { init: function init() { this.resizeTimer = Timer(100, 500, function () { @@ -1205,7 +1217,7 @@ var Hints = Module("hints", { value.matcher = compileMatcher(Option.splitList(value.result)); return vals; }, - validator: Option.validateXPath + validator: validateMatcher }); options.add(["hinttags", "ht"], @@ -1218,7 +1230,7 @@ var Hints = Module("hints", { this.matcher = compileMatcher(values); return values; }, - validator: Option.validateXPath + validator: validateMatcher }); options.add(["hintkeys", "hk"], diff --git a/common/modules/options.jsm b/common/modules/options.jsm index 7a9452fc..7f53d6be 100644 --- a/common/modules/options.jsm +++ b/common/modules/options.jsm @@ -687,13 +687,6 @@ var Option = Class("Option", { if (this.type === "regexpmap" || this.type === "sitemap") return Array.concat(values).every(function (re) acceptable.some(function (item) item[0] == re.result)); return Array.concat(values).every(function (value) acceptable.some(function (item) item[0] == value)); - }, - - validateXPath: function (values) { - return true; // For now. - let evaluator = services.XPathEvaluator(); - return this.testValues(values, - function (value) evaluator.createExpression(value, util.evaluateXPath.resolver)); } }); diff --git a/pentadactyl/NEWS b/pentadactyl/NEWS index e8d2ca69..c5e6ea40 100644 --- a/pentadactyl/NEWS +++ b/pentadactyl/NEWS @@ -129,6 +129,8 @@ - :delstyle, :styleenable, :styledisable and :styletoggle accept a ! to operate on all styles. [b6] * IMPORTANT option changes: + - 'hinttags' and 'extendedhinttags' now treat their values as + CSS selectors by default. [b6] - Option value quoting has changed. List options will no longer be split at quoted commas and the option name, operators, and = sign may no longer be quoted. This will break certain