Skip to content

Commit

Permalink
strip empty text nodes (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshuawuyts authored May 2, 2017
1 parent 1bddb30 commit 66fcc40
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/appendChild.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = function yoyoifyAppendChild (el, childs) {
node = node.toString()
}
if (typeof node === 'string') {
if (/^[\n\r\s]+$/.test(node)) continue
if (el.lastChild && el.lastChild.nodeName === '#text') {
el.lastChild.nodeValue += node
continue
Expand Down

0 comments on commit 66fcc40

Please sign in to comment.