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

feat(compiler): switch to new removeWhitespace option (#9208) #9217

Closed
wants to merge 1 commit into from

Conversation

Justineo
Copy link
Member

@Justineo Justineo commented Dec 18, 2018

Provide removeWhitespace option for smarter whitespace trimming. Resolves #9208.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

See #9208.

Other information:

Also added the missing test cases for the old preserveWhitespace option.

expect(ast.children[3].tag).toBe('i')
expect(ast.children[3].children[0].text).toBe('world')
expect(ast.children[4].type).toBe(3)
expect(ast.children[4].text).toBe('.\n Have fun!')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this newline be condensed to a single space?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, we need to handle this. I forgot to collapse these in the middle of a string.

I'm also wondering if we can have a better option name and values to better describe the behavior. Unlike the previous remove/preserve logic, the new logic also include collapsing. I'm not quite satisfied with removeWhitespace yet...Thoughts?

@yyx990803 yyx990803 changed the base branch from dev to 2.6 December 26, 2018 16:03
@yyx990803
Copy link
Member

See #9208 (comment)

@yyx990803 yyx990803 closed this Dec 26, 2018
@Justineo
Copy link
Member Author

Nice 👍

@Justineo Justineo deleted the feature-remove-whitespace branch December 27, 2018 02:49
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

Successfully merging this pull request may close these issues.

2 participants