Skip to content

Commit db428c5

Browse files
committed
skip empty content nodes
1 parent 4ef3def commit db428c5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

misc/highlight.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,12 @@
9393
for (let ti = 0; ti < tags.length; ti++) {
9494
let pNodes = document.getElementsByTagName(tags[ti]);
9595
for (let i = 0; i < pNodes.length; i++) {
96-
let text = pNodes[i].innerHTML;
96+
let text = pNodes[i].innerText.trim();
97+
if (text === "") {
98+
continue;
99+
}
100+
101+
text = pNodes[i].innerHTML;
97102

98103
for (let j = 0; j < words.length; j++) {
99104
text = text.highlight(words[j], color);

0 commit comments

Comments
 (0)