We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 73e94a8 commit 0b09ab2Copy full SHA for 0b09ab2
lib/parse.js
@@ -70,11 +70,14 @@ module.exports = function parse(html, options) {
70
// calculate correct end of the content slice in case there's
71
// no tag after the text node.
72
var end = html.indexOf('<', start);
73
- end = end === -1 ? undefined : end;
74
- parent.push({
75
- type: 'text',
76
- content: html.slice(start, end)
77
- });
+ var content = html.slice(start, end === -1 ? undefined : end);
+ // if a node is nothing but whitespace, no need to add it.
+ if (!/^\s*$/.test(content)) {
+ parent.push({
+ type: 'text',
78
+ content: content
79
+ });
80
+ }
81
}
82
83
});
0 commit comments