From d5ee31a0801607fe548ba74a5c1f646e14f3cbb6 Mon Sep 17 00:00:00 2001 From: eight Date: Wed, 26 Sep 2018 11:37:50 +0800 Subject: [PATCH] Fix: a better way to draw character list? --- js/usercss.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/usercss.js b/js/usercss.js index 6be1e3e2..1f7a4df4 100644 --- a/js/usercss.js +++ b/js/usercss.js @@ -32,7 +32,7 @@ var usercss = (() => { return backgroundWorker.parseUsercssMeta(match[0], match.index) .catch(err => { if (err.code) { - const args = ERR_ARGS_IS_LIST.has(err.code) ? err.args.join(', ') : err.args; + const args = ERR_ARGS_IS_LIST.has(err.code) ? drawList(err.args) : err.args; const message = chrome.i18n.getMessage(`meta_${err.code}`, args); if (message) { err.message = message; @@ -49,6 +49,10 @@ var usercss = (() => { }); } + function drawList(chars) { + return chars.map(c => c === '"' ? "'\"'" : `"${c}"`).join(', '); + } + /** * @param {Object} style * @param {Boolean} [allowErrors=false]