fix(check): fix some html check bugs

This commit is contained in:
Dillon
2020-02-18 16:22:24 +08:00
parent d8681cd489
commit 4b3addf634
20 changed files with 53 additions and 67 deletions

View File

@@ -84,16 +84,6 @@
this.util.forEach(toc.querySelectorAll('a:first-child'), (link) => {
link.classList.add('toc-link');
});
// when headings do not start with `h1`
const oldTocList = toc.children[0];
let newTocList = oldTocList;
let temp;
while (newTocList.children.length === 1
&& (temp = newTocList.children[0].children[0]).tagName === 'UL') {
newTocList = temp;
}
if (newTocList !== oldTocList) toc.replaceChild(newTocList, oldTocList);
}
_initTocState(tocContainer) {
@@ -157,7 +147,7 @@
initToc() {
const tocContainer = document.getElementById('post-toc');
if (tocContainer !== null) {
const toc = document.getElementById('TableOfContents');
const toc = tocContainer.getElementById('TableOfContents');
if (toc === null) {
tocContainer.parentElement.removeChild(tocContainer);
} else {