mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-12-18 07:12:52 +03:00
Fix cloak mode issues on Safari
This commit is contained in:
parent
014e694a4a
commit
8d98ccff83
1 changed files with 11 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue