Skip to content

Commit

Permalink
issue #115
Browse files Browse the repository at this point in the history
  • Loading branch information
taoqf committed May 22, 2021
1 parent 311454f commit 8cd256f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nodes/html.ts
Expand Up @@ -272,7 +272,7 @@ export default class HTMLElement extends Node {
dfs(this);
return blocks.map((block) => {
// Normalize each line's whitespace
return block.join('').trim().replace(/\s{2,}/g, ' ');
return block.join('').replace(/\s{2,}/g, ' ');
})
.join('\n').replace(/\s+$/, ''); // trimRight;
}
Expand Down
9 changes: 9 additions & 0 deletions test/115.js
@@ -0,0 +1,9 @@
const { parse } = require('../dist');

describe('issue 115', function () {
it('parse html', async function () {
const html = '<p>Hello <strong>world</strong>!</p>';
const root = parse(html);
root.firstChild.innerText.should.eql('Hello world!');
});
});

0 comments on commit 8cd256f

Please sign in to comment.