Skip to content

Commit

Permalink
fix(utils): improve removeWhitespace()
Browse files Browse the repository at this point in the history
  • Loading branch information
XPoet committed Oct 7, 2023
1 parent d56974a commit d556159
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions source/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,12 @@ KEEP.initUtils = () => {
},

// remove white space between children
removeWhitespace(containerElement) {
const childNodes = containerElement.childNodes
removeWhitespace(container) {
if (!container) {
return
}

const childNodes = container.childNodes
const whitespaceNodes = []

for (let i = 0; i < childNodes.length; i++) {
Expand All @@ -639,7 +643,7 @@ KEEP.initUtils = () => {
}

for (const whitespaceNode of whitespaceNodes) {
containerElement.removeChild(whitespaceNode)
container.removeChild(whitespaceNode)
}
},
trimPostMetaInfoBar() {
Expand Down

0 comments on commit d556159

Please sign in to comment.