🐛 Fix(ignore): TypeError: Cannot read properties of null (reading 'cloneNode')

This commit is contained in:
Cell
2024-07-24 15:39:57 +08:00
parent dd33cabe16
commit bcd6987910
+5 -3
View File
@@ -581,9 +581,11 @@ class FixIt {
if (typeof APlayer === 'function') {
// remove APlayer click event listener of the toc link
let $tocCore = document.getElementById('TableOfContents');
const $newTocCore = $tocCore.cloneNode(true);
$tocCore.parentElement.replaceChild($newTocCore, $tocCore);
$tocCore = $newTocCore;
if ($tocCore) {
const $newTocCore = $tocCore.cloneNode(true);
$tocCore.parentElement.replaceChild($newTocCore, $tocCore);
$tocCore = $newTocCore;
}
// remove APlayer click event listener of the heading mark
this.util.forEach(document.querySelectorAll('.heading-mark'), ($headingMark) => {
const $newHeadingMark = $headingMark.cloneNode(true);