code cosmetics
Reorganize showRegExpTester()'s render stats code to better reflect the displayed structure/order of data
This commit is contained in:
parent
23c870ceb9
commit
c963a13932
27
edit/edit.js
27
edit/edit.js
|
@ -1897,15 +1897,17 @@ function showRegExpTester(event, section = getSectionForChild(this)) {
|
|||
if (!data.length) {
|
||||
continue;
|
||||
}
|
||||
const block = report.appendChild($element({
|
||||
tag: 'details',
|
||||
open: true,
|
||||
dataset: {type},
|
||||
appendChild: $element({tag: 'summary', appendChild: label}),
|
||||
}));
|
||||
// 2nd level: regexp text
|
||||
const summary = $element({tag: 'summary', appendChild: label});
|
||||
const block = [summary];
|
||||
for (const {text, urls} of data) {
|
||||
if (!urls) {
|
||||
block.push(text, br.cloneNode());
|
||||
continue;
|
||||
}
|
||||
block.push($element({
|
||||
if (urls) {
|
||||
// type is partial or full
|
||||
block.appendChild($element({
|
||||
tag: 'details',
|
||||
open: true,
|
||||
appendChild: [
|
||||
|
@ -1914,13 +1916,12 @@ function showRegExpTester(event, section = getSectionForChild(this)) {
|
|||
...urls,
|
||||
],
|
||||
}));
|
||||
} else {
|
||||
// type is none or invalid
|
||||
block.appendChild(document.createTextNode(text));
|
||||
block.appendChild(br.cloneNode());
|
||||
}
|
||||
}
|
||||
report.appendChild($element({
|
||||
tag: 'details',
|
||||
open: true,
|
||||
dataset: {type},
|
||||
appendChild: block,
|
||||
}));
|
||||
}
|
||||
showHelp(t('styleRegexpTestTitle'), report);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user