adasd
This commit is contained in:
@@ -33,17 +33,14 @@
|
|||||||
const frag = document.createDocumentFragment();
|
const frag = document.createDocumentFragment();
|
||||||
if (addBreak) {
|
if (addBreak) {
|
||||||
const prev = el.previousSibling;
|
const prev = el.previousSibling;
|
||||||
const needsLeadBreak = !!(prev && (prev.nodeType === 3 ? prev.textContent.trim() : (prev.tagName && prev.tagName !== 'BR')));
|
const hasPrevContent = !!(prev && (prev.nodeType === 3 ? prev.textContent.trim() : (prev.tagName && prev.tagName !== 'BR')));
|
||||||
if (needsLeadBreak) {
|
if (hasPrevContent) {
|
||||||
frag.appendChild(document.createElement('br'));
|
frag.appendChild(document.createElement('br'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (el.firstChild) {
|
while (el.firstChild) {
|
||||||
frag.appendChild(el.firstChild);
|
frag.appendChild(el.firstChild);
|
||||||
}
|
}
|
||||||
if (addBreak) {
|
|
||||||
frag.appendChild(document.createElement('br'));
|
|
||||||
}
|
|
||||||
el.replaceWith(frag);
|
el.replaceWith(frag);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user