usercss saving: display errors from mozparser in <pre>
This commit is contained in:
parent
8d3fd9cc3b
commit
13d7e30a75
|
@ -227,7 +227,9 @@ function createSourceEditor(style) {
|
|||
}));
|
||||
return;
|
||||
}
|
||||
const contents = [String(err)];
|
||||
const contents = Array.isArray(err) ?
|
||||
$element({tag: 'pre', textContent: err.join('\n')}) :
|
||||
[String(err)];
|
||||
if (Number.isInteger(err.index)) {
|
||||
const pos = cm.posFromIndex(err.index);
|
||||
contents[0] += ` (line ${pos.line + 1} col ${pos.ch + 1})`;
|
||||
|
|
|
@ -165,7 +165,7 @@ function $element(opt) {
|
|||
const element = ns
|
||||
? document.createElementNS(ns === 'SVG' || ns === 'svg' ? 'http://www.w3.org/2000/svg' : ns, tag)
|
||||
: document.createElement(tag || 'div');
|
||||
const children = opt.appendChild instanceof Array ? opt.appendChild : [opt.appendChild];
|
||||
const children = Array.isArray(opt.appendChild) ? opt.appendChild : [opt.appendChild];
|
||||
for (const child of children) {
|
||||
if (child) {
|
||||
element.appendChild(child instanceof Node ? child : document.createTextNode(child));
|
||||
|
|
Loading…
Reference in New Issue
Block a user