mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-25 21:15:46 +01:00
Add cheap CSS highlighting which is unfortunately far to slow to make any use of.
This commit is contained in:
@@ -161,14 +161,15 @@ var Template = Module("Template", {
|
||||
|
||||
highlightRegexp: function highlightRegexp(str, re, highlight) {
|
||||
return this.highlightSubstrings(str, (function () {
|
||||
re.lastIndex = 0;
|
||||
let res;
|
||||
while ((res = re.exec(str)) && res[0].length)
|
||||
yield [res.index, res[0].length, res];
|
||||
yield [res.index, res[0].length, res.wholeMatch ? [res] : res];
|
||||
})(), highlight || template.filter);
|
||||
},
|
||||
|
||||
highlightSubstrings: function highlightSubstrings(str, iter, highlight) {
|
||||
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
|
||||
XML.ignoreWhitespace = XML.prettyPrinting = false;
|
||||
if (typeof str == "xml")
|
||||
return str;
|
||||
if (str == "")
|
||||
|
||||
Reference in New Issue
Block a user