Skip to content

Commit

Permalink
Don't wrap in span if there's nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
cheeaun committed Feb 3, 2025
1 parent e8dae8f commit 79641b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/enhance-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ function _enhanceContent(content, opts = {}) {
// Workaround for Safari so that `text-decoration-thickness` works
// Wrap child text nodes in spans
for (const node of dom.childNodes) {
if (node.nodeType === Node.TEXT_NODE) {
if (node.nodeType === Node.TEXT_NODE && node.textContent.trim?.()) {
const span = document.createElement('span');
span.textContent = node.textContent;
dom.replaceChild(span, node);
Expand Down

0 comments on commit 79641b4

Please sign in to comment.