1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-07 14:14:13 +01:00

Provide util.regexpSource to avoid escaping slash when not necessary.

This commit is contained in:
Štěpán Němec
2010-12-06 03:54:22 +01:00
parent b765c5e96c
commit a219601931
3 changed files with 11 additions and 3 deletions

View File

@@ -391,7 +391,7 @@ const Option = Class("Option", {
re.toString = function () Option.unparseRegexp(this);
return re;
},
unparseRegexp: function (re) re.bang + Option.quote(re.source.replace(/\\(.)/g, function (m, n1) n1 == "/" ? n1 : m), /^!|:/) +
unparseRegexp: function (re) re.bang + Option.quote(util.regexpSource(re), /^!|:/) +
(typeof re.result === "boolean" ? "" : ":" + Option.quote(re.result)),
getKey: {