diff --git a/src/utils/enhance-content.js b/src/utils/enhance-content.js index caf05b1b..dc65480d 100644 --- a/src/utils/enhance-content.js +++ b/src/utils/enhance-content.js @@ -290,6 +290,17 @@ function _enhanceContent(content, opts = {}) { } } + // FIX CLOAK MODE FOR SAFARI + // 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) { + const span = document.createElement('span'); + span.textContent = node.textContent; + dom.replaceChild(span, node); + } + } + if (postEnhanceDOM) { queueMicrotask(() => postEnhanceDOM(dom)); // postEnhanceDOM(dom); // mutate dom