Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
falsandtru committed Jun 10, 2023
1 parent 71fd316 commit f1362b8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/util/toc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ function level(h: HTMLHeadingElement): number {
function unlink(h: HTMLHeadingElement): Iterable<Node> {
for (let es = h.getElementsByTagName('a'), len = es.length, i = 0; i < len; ++i) {
const el = es[i];
el.replaceWith(...el.childNodes);
assert(el.childNodes.length <= 1);
el.firstChild
? el.replaceWith(el.firstChild)
: el.remove();
}
return h.childNodes;
}

0 comments on commit f1362b8

Please sign in to comment.