mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-21 21:29:20 +01: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) {
|
if (postEnhanceDOM) {
|
||||||
queueMicrotask(() => postEnhanceDOM(dom));
|
queueMicrotask(() => postEnhanceDOM(dom));
|
||||||
// postEnhanceDOM(dom); // mutate dom
|
// postEnhanceDOM(dom); // mutate dom
|
||||||
|
|
Loading…
Reference in a new issue