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
41
edit/edit.js
41
edit/edit.js
|
@ -1897,30 +1897,31 @@ function showRegExpTester(event, section = getSectionForChild(this)) {
|
||||||
if (!data.length) {
|
if (!data.length) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 2nd level: regexp text
|
const block = report.appendChild($element({
|
||||||
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({
|
|
||||||
tag: 'details',
|
|
||||||
open: true,
|
|
||||||
appendChild: [
|
|
||||||
$element({tag: 'summary', textContent: text}),
|
|
||||||
// 3rd level: tab urls
|
|
||||||
...urls,
|
|
||||||
],
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
report.appendChild($element({
|
|
||||||
tag: 'details',
|
tag: 'details',
|
||||||
open: true,
|
open: true,
|
||||||
dataset: {type},
|
dataset: {type},
|
||||||
appendChild: block,
|
appendChild: $element({tag: 'summary', appendChild: label}),
|
||||||
}));
|
}));
|
||||||
|
// 2nd level: regexp text
|
||||||
|
for (const {text, urls} of data) {
|
||||||
|
if (urls) {
|
||||||
|
// type is partial or full
|
||||||
|
block.appendChild($element({
|
||||||
|
tag: 'details',
|
||||||
|
open: true,
|
||||||
|
appendChild: [
|
||||||
|
$element({tag: 'summary', textContent: text}),
|
||||||
|
// 3rd level: tab urls
|
||||||
|
...urls,
|
||||||
|
],
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
// type is none or invalid
|
||||||
|
block.appendChild(document.createTextNode(text));
|
||||||
|
block.appendChild(br.cloneNode());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
showHelp(t('styleRegexpTestTitle'), report);
|
showHelp(t('styleRegexpTestTitle'), report);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user