mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-24 00:38:49 +01:00
Don't wrap in span if there's nothing
This commit is contained in:
parent
e8dae8f8da
commit
79641b47a5
1 changed files with 1 additions and 1 deletions
|
@ -294,7 +294,7 @@ function _enhanceContent(content, opts = {}) {
|
||||||
// Workaround for Safari so that `text-decoration-thickness` works
|
// Workaround for Safari so that `text-decoration-thickness` works
|
||||||
// Wrap child text nodes in spans
|
// Wrap child text nodes in spans
|
||||||
for (const node of dom.childNodes) {
|
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');
|
const span = document.createElement('span');
|
||||||
span.textContent = node.textContent;
|
span.textContent = node.textContent;
|
||||||
dom.replaceChild(span, node);
|
dom.replaceChild(span, node);
|
||||||
|
|
Loading…
Reference in a new issue