Skip to content

Commit

Permalink
🐛 Fix(ignore): TypeError: Cannot read properties of null (reading 'cl…
Browse files Browse the repository at this point in the history
…oneNode')
  • Loading branch information
Lruihao committed Jul 24, 2024
1 parent dd33cab commit bcd6987
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions assets/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bcd6987

Please sign in to comment.