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

Warn about Infinity in style value #9360

Merged
merged 2 commits into from
Apr 21, 2017
Merged

Conversation

vitalets
Copy link
Contributor

@vitalets vitalets commented Apr 7, 2017

Currently React warns about NaN values in style.
This PR adds warnings about Infinity:

<h1 style={{ fontSize: 1 / 0 }}></h1>

Warning:

Warning: `Infinity` is an invalid value for the `fontSize` css style property.

Copy link
Contributor

@aweary aweary left a comment

Choose a reason for hiding this comment

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

Thanks, @vitalets. This seems like a good case to warn about, LGTM!

@aweary
Copy link
Contributor

aweary commented Apr 10, 2017

cc @spicyj are we OK with adding this new warning?

@gaearon
Copy link
Collaborator

gaearon commented Apr 18, 2017

I’ve made this mistake a few times. IMO let’s merge it. Worst case scenario somebody will explain the reasoning, we’ll revert and learn 😄

@syranide
Copy link
Contributor

Just FYI. The reason we warn for NaN is because it breaks comparison checks, not because of the value itself. Not saying it's a bad idea though.

@gaearon
Copy link
Collaborator

gaearon commented Apr 21, 2017

Sorry for the churn—can you please rebase this?

@aweary If you approve something, feel free to merge. We can always revert later. Otherwise things get stale.

@aweary
Copy link
Contributor

aweary commented Apr 21, 2017

Sorry about that, I went ahead and rebased it myself. Thanks again @vitalets!

@aweary aweary merged commit 895dca5 into facebook:master Apr 21, 2017
@vitalets
Copy link
Contributor Author

Thank you @aweary !

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

Successfully merging this pull request may close these issues.

5 participants