mirror of
https://github.com/debug-js/debug.git
synced 2026-01-25 16:42:28 +00:00
browser: don't let "%%" throw off the color insertion index
This commit is contained in:
parent
a4aacbd785
commit
0f61fca93f
@ -85,12 +85,12 @@ function log() {
|
||||
// figure out the correct index to insert the CSS into
|
||||
var index = 0;
|
||||
args[0].replace(/%[a-z%]/g, function(match) {
|
||||
if ('%%' === match) return;
|
||||
index++;
|
||||
if (index < 3) return; // skip the first 2 %c's since that's handled already
|
||||
if ('%c' === match) {
|
||||
args.splice(index, 0, c);
|
||||
}
|
||||
return match;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user