Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitespace/ommited tags fidelity issue + headless browser testing proposal #59

Open
abuyoyo opened this issue Jan 19, 2021 · 0 comments

Comments

@abuyoyo
Copy link
Contributor

abuyoyo commented Jan 19, 2021

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant