Skip to content

Ignores non-significant Text node and preserves significant white space characters

Boris Budini requested to merge issue-176-fix-whitespace into master

Based on #113 (closed)

This merge request ignores non-significant Node such as

  • A Text node that is all whitespace
  • A Comment node

It also preserves Text node that does not have any sibling such as:

<p>   </p>

And Text node with a sibling, such as:

Hello   <span>world</span>

Here, the Text node after "Hello" and before the <span> element must be preserved. In this case, the textContent is updated to a single space:

Hello <span>world</span>

I think it should fix a few issues:

I will try to add additional tests cases.

Edited by Boris Budini

Merge request reports