-
-
Notifications
You must be signed in to change notification settings - Fork 144
fix(view): preserve whitespace between inline HTML elements #1868
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
Conversation
TimWolla
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't quite correct. Whitespace introduced by linebreaks also needs to be preserved. See: https://jsfiddle.net/rh7y1xg4/
|
@TimWolla Can you take a look now please? |
TimWolla
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test assertions LGTM. Cannot comment on the actual logic changes, due to my lack of familiarity with them.
I'd like to note one more thing, though: Elements with white-space: pre CSS (or a corresponding class) will still be affected either way. Technically removing whitespace is never safe (at least not within the body).
@brendt I think I might need some help with this 👀 |
|
I thought about it this night and actually think I want to take another approach: we can add a new whitespace token to the lexer and simply keep whitespaces as is, always. It also means we wouldn't have to introduce another regex match, which is always good. I'm not sure if this would have any other implications, so I'm going to fiddle around with it (or you can @xHeaven if you want to). Anyway I'll close this PR but I'll copy over the tests |
Your solution turned out way more elegant after all. Good work! |
Closes #1867.