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