Fix: drop isEmpty

This commit is contained in:
eight 2018-09-01 21:38:38 +08:00
parent 8894934290
commit a7ccda3aad

View File

@ -78,19 +78,13 @@ var linterReport = (() => { // eslint-disable-line no-var
const tbody = $create('tbody'); const tbody = $create('tbody');
const table = $create('table', [caption, tbody]); const table = $create('table', [caption, tbody]);
const trs = []; const trs = [];
let empty = true;
return { return {
element: table, element: table,
trs, trs,
updateAnnotations, updateAnnotations,
update, update
isEmpty
}; };
function isEmpty() {
return empty;
}
function update() { function update() {
caption.textContent = typeof editor === 'object' ? caption.textContent = typeof editor === 'object' ?
'' : `${t('sectionCode')} ${editors.indexOf(cm) + 1}`; '' : `${t('sectionCode')} ${editors.indexOf(cm) + 1}`;
@ -113,8 +107,7 @@ var linterReport = (() => { // eslint-disable-line no-var
while (trs.length > i) { while (trs.length > i) {
trs.pop().element.remove(); trs.pop().element.remove();
} }
empty = i === 0; table.classList.toggle('empty', trs.length === 0);
table.classList.toggle('empty', empty);
function *getAnnotations() { function *getAnnotations() {
for (const line of lines.filter(Boolean)) { for (const line of lines.filter(Boolean)) {