Whitespace/ommited tags fidelity issue + headless browser testing proposal
abuyoyo opened this issue · 0 comments
What is this feature about (expected vs actual behaviour)?
HtmlMin should not add a whitespace when ommitting </p>
This was mentioned in issue #50 (after it was closed) so I think there was no follow up.
How can I reproduce it?
The following HTML
<div>
<p>Text</p>
</div>
should minify to <div><p>Text</div>
and NOT to <div><p>Text </div>
(which is the current implementation).
If you pass these to a browser, you will notice the DOM output is not the same for the original and for the minified version:
"Text "
!= "Text"
(notice the trailing whitespace in the DOM for the minified version that is not there in the non-minified HTML's DOM output).
Does it take minutes, hours or days to fix?
It probably requires some work.
Any additional information?
One way to test for this, and similar fidelity issues is to add a headless browser to the unit tests.
The tests would use non-minified HTML and a minified version of that HTML fed seperately into the headless browser.
If the DOM output of the two versions are not exact - the tests would fail.
Such a tesing suite should pick up many similar fidelity issues (if there are any).