-
Notifications
You must be signed in to change notification settings - Fork 47.1k
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
jsx transform: "for" should be renamed as "class" is #269
Conversation
I'm going to leave this open for now for some discussion, but (like we talked about on IRC), I don't think we should do this (and I think we should get rid of var Component = React.createClass({
render: function() {
return <div class={this.props.className} />;
}
});
React.renderComponent(<Component class="foo" />, document.body); You can't actually access Not everybody agrees with me, so let's start that discussion... |
Well for me main concern was discoverability of those special cases. Right now compiler just silently eats 'for' and says nothing at all. And while this is more or less acceptable for other properties, React declares that it passes all HTML attributes. This note about |
Totally agree. We should probably make #267 know about |
I'm a little out of context here, but why is it a problem to have a property name of |
@jeffmo because you access it in the child using |
I see...and the reason these things are renamed is really just because of issues when dealing with old versions of IE right? (because they don't like it when you access object non-computed properties named the same as a keyword) Under the assumption that's the reasoning for all this, I think we might need a more general solution than just making up case-by-case magically renamed identifiers for all JS keywords. Maybe we come up with a more standardized renaming scheme for keyword attributes? Like Also, (still assuming stupid old IE is the only reason for all this) for people who don't care about old IE it would be nice if we set both I'm positive this topic has been discussed before -- I just wasn't around for the discussion, so anyone feel free to point out anything I'm missing. |
As far as I know, the only thing broken about |
In fact, I would agree that's not a terrible thing to do if you care about IE7 -- and anyone who thinks it looks ugly should blame IE7, not us :) |
I recall @zpao saying that |
I personally would love it if we didn't translate props like this at all though -- I probably should have mentioned that in my previous comment. ES6 has a |
Yea ok -- chatted this over with @zpao and @jordwalke and I think we three agreed that it would be best if there were consistency between attribute names and the property identifiers you access them through. That could mean one of two things: We either stop converting 'class' -> 'className' and just do |
I'm against using |
So |
@chenglou well, it is fine. Though I think, I have no voice on this issue cause I use CoffeeScript and it compiles |
I think that the value of copying and pasting HTML and having a (mostly) working component is huge. So +1 to |
+1 for storing it as |
|
@zpao @jeffmo @jordwalke @petehunt so what's the decision? Will we have 'class' or is it going to be a className? :-) |
We just had a big discussion here. We're going to send out some proposals internally soon and I'll post them on the google group too (with link here in case you aren't signed up). |
We're going in the opposite direction and not supporting any prop transforms. The result of that decision and the ensuing discussion resulted in d83fe78 and the final decision that we will not be supporting @piranha, I really appreciate you taking the initiative here which forced us to make a decision. |
JSX renames
class
toclassName
, but is not doing the same forfor
, which causes a bit of confusion.