-
Notifications
You must be signed in to change notification settings - Fork 46.7k
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
Make on/off, yes/no boolean attributes work #10589
Comments
This could be a can of worms. autosave crossorigin var img = new Image()
console.log(img.crossOrigin) // null
a.setAttribute('crossorigin', '')
console.log(a.crossOrigin) // anonymous For the cross origin case, I think we need to assign autocapitalize The trouble is figuring out what false does for this case. Maybe, I'd say:
|
I think it makes sense to do this only for attributes that accept boolean options like
There are other attributes with canonical cases. For example, If we did normalize it I think we should only do it in cases where users already expect it to work, and add warnings about it so we could eventually stop. The attributes with "true" boolean enumerations that we could normalize would be:
|
IMHO this. Perhaps I've missed too much of the discussion, but AFAIK it seems like there's a good reason why they aren't straight up boolean attributes, some of them default to true, some of them default to neither where not being set is special (like But I'm curious, from what I understand you want to avoid the whitelist and special-behavior. Why not adopt these rules:
These are simple rules to understand and you would know exactly what to expect from ReactDOM at all times, it wouldn't depend on some "maybe updated whitelist" and it wouldn't change between versions as the whitelist is updated and it would work for unsupported attributes too. Obviously you would need a temporary workaround where ReactDOM emit warnings in cases where we previously handled it okay-ish. |
Does the approach I outlined in #10521 (comment) sound like what you're thinking? |
@aweary Oh sorry, yeah it seems you already had it figured out. IMHO, that seems like a sensible approach. |
Taking off 16 milestone but let’s come back to this some time during 16.x to decide on the strategy for 17. |
When you pass a boolean to some attributes (e.g.
autoSave
,autoCorrect
) in 15, they don't work correctly because they actually want a specific string (yes
andno
). I think there were also some attributes that wanton
andoff
.Let's just “make them work”? Could use a special flag/whitelist for that. There should be very few of these.
Similarly we should probably make
<script crossOrigin />
be valid and turn into<script crossOrigin="anonymous" />
. Currently I don’t think this works on master.The text was updated successfully, but these errors were encountered: