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

[fix]: [collapseWhitespace] Normalize white spaces safely #21

Closed
maltsev opened this issue Feb 10, 2016 · 8 comments
Closed

[fix]: [collapseWhitespace] Normalize white spaces safely #21

maltsev opened this issue Feb 10, 2016 · 8 comments
Labels
Milestone

Comments

@maltsev
Copy link
Member

maltsev commented Feb 10, 2016

Using \s to normalize HTML whitespace will strip out characters that are actually rendered by a web browser. Such would be classified as a lossy change and would produce a different visual result.
https://www.npmjs.com/package/normalize-html-whitespace

@stevenvachon, thanks for the idea.

@maltsev maltsev added the bug label Feb 10, 2016
@stevenvachon
Copy link

Along with this, whitespace between tags within <head> (except for <title>) can be completely removed as the entire element is not rendered.

@maltsev
Copy link
Member Author

maltsev commented Feb 22, 2016

@stevenvachon, thanks! I've created an issue for that: #24

@Scrum Scrum modified the milestones: 0.1.7, 0.1.8 Mar 13, 2018
@Scrum Scrum changed the title [collapseWhitespace] Normalize white spaces safely [fix]: [collapseWhitespace] Normalize white spaces safely Mar 13, 2018
@fregante
Copy link

fregante commented Mar 18, 2018

I think this is fixed (at least partially) by setting collapseWhitespace: 'conservative'.

I saw the <em>space</em> before/after em being removed and that option avoids that.

@stevenvachon
Copy link

I haven't researched how web browsers render spaces across different elements. I think that it changes depending on block/inline level, which can be overridden via CSS. It might be safer to simply reduce multiple spaces to single spaces via the above mentioned library.

@fregante
Copy link

Exactly. Ignore I set two div to display: inline the space will matter

@stevenvachon
Copy link

stevenvachon commented Mar 26, 2018

Ok. As originally stated, though, the "conservative" /s+ is not the same as the above mentioned library.

Also, I think that the default should not be "all", since it results in unexpected render differences.

maltsev added a commit that referenced this issue Sep 13, 2018
@maltsev
Copy link
Member Author

maltsev commented Sep 13, 2018

Done. It'll be released in 0.2.0 version (I think next week).

@maltsev maltsev closed this as completed Sep 13, 2018
@maltsev
Copy link
Member Author

maltsev commented Sep 14, 2018

Released: 0.2.0.

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

No branches or pull requests

4 participants