Skip to content

Parser incorrectly collapses whitespace  #80

@ZhangYiJiang

Description

@ZhangYiJiang

To reproduce: Run the following

$dom = new Dom();
$dom->load('<pre>    Hello world</pre>');
echo $dom; 

Result:

=> "<pre> Hello world</pre>"

The resultant HTML has its four spaces collapsed to one. This will break any use cases for whitespace sensitive HTML (such as in <pre> tags), and is just bad practise in general, since the parser is silently modifying the HTML. The whitespaceTextNode should already be enabled by default, but even with it enabled manually this still occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions