browser: don't let "%%" throw off the color insertion index

This commit is contained in:
Nathan Rajlich 2014-05-31 14:17:21 -07:00
parent a4aacbd785
commit 0f61fca93f

View File

@ -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;
});
}