Skip to content

preserveWhiteSpace not supported #23

@ygoe

Description

@ygoe

Just wondering why this doesn't produce "minified" HTML output:

$dom = new IvoPetkov\HTML5DOMDocument();
$dom->preserveWhiteSpace = false;
$dom->loadHTML($html);
return $dom->saveHTML();

HTML5DOMDocument inherits from DOMDocument and that should have the preserveWhiteSpace property. It defaults to true and according to numerous Stack Overflow answers, setting it to false produces output without whitespace-only text nodes, like indenting. It doesn't change my HTML in any way however.

The property does exist, is initially true, and is no longer true after setting it to false. It just has no effect here.

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