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

ClassName and Class inconsistency #5926

Closed
mikeybox opened this issue Jan 27, 2016 · 5 comments
Closed

ClassName and Class inconsistency #5926

mikeybox opened this issue Jan 27, 2016 · 5 comments

Comments

@mikeybox
Copy link

Standard elements and custom elements have a diverging API in the case of the class attribute (and for), they should be consistent to aid developer use. I would suggest that the custom-element naming is the better solution. While class and for are keywords that is obviously mitigated by the fact they're used as object properties

@nhunzaker
Copy link
Contributor

What do you think, @gaearon, particularly after #7311? We already alias className to class under the hood. What if we just supported both without a warning?

Similarly for for.

@aweary
Copy link
Contributor

aweary commented Jul 12, 2017

Supporting both class and className sounds reasonable to me, with the downside being that it introduces more overhead for keeping a React codebase consistent. Though, that can be mitigated by linting tools.

As long as this doesn't introduce a problem with any of our supported browsers (IE8 would throw when accessing props.class, but that's not a problem anymore) I'm in favor of allowing it.

@aweary
Copy link
Contributor

aweary commented Sep 20, 2017

This behavior has changed as of React 16, see DOM Attributes in React 16. Using class will result in a warning, but it will still render the attribute. It was decided that we should continue to recommend using the existing attribute names, but be more lenient about rendering them to the DOM.

I don't believe there's any intention to move to class/ for, etc as the canonical names, so I'm going to close this out. Thanks!

@aweary aweary closed this as completed Sep 20, 2017
@r3wt
Copy link

r3wt commented Dec 9, 2017

fucking idiots

@nhunzaker
Copy link
Contributor

Sorry you feel this way, but this sort of behavior is unacceptable. Locking this thread.

@facebook facebook locked and limited conversation to collaborators Dec 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants