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

Bug: renderToString renders srcSet instead of srcset #19799

Closed
vasimi opened this issue Sep 9, 2020 · 5 comments
Closed

Bug: renderToString renders srcSet instead of srcset #19799

vasimi opened this issue Sep 9, 2020 · 5 comments

Comments

@vasimi
Copy link

vasimi commented Sep 9, 2020

React version: 16.12.0

Steps To Reproduce

  1. Use renderToString to render <source> element with srcset attribute

Link to code example: https://codesandbox.io/s/react-dom-camelcase-bug-1rnxt

The current behavior

srcSet isn't transformed to srcset

The expected behavior

srcSet becomes srcset

@vasimi vasimi added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Sep 9, 2020
@eps1lon
Copy link
Collaborator

eps1lon commented Sep 9, 2020

This applies to all camel-cased attributes in React e.g. defaultValue or autoPlay. This issue came up in the past in #13162 and was closed since it didn't seem to have any actual impact and the living standard doesn't enforce them to be case-sensitivity.

It was also brought up in #12403 and closed with the following explanation:

HTML is case-insensitive. I agree it can be a bit surprising but there is no practical difference to the browser, and it might be a bit faster for us to avoid lowercasing it.

-- #12403 (comment)

Please ping me if there is any actual impact.

Other duplicates: #11160 and #10863

@eps1lon eps1lon closed this as completed Sep 9, 2020
@eps1lon eps1lon added Resolution: Duplicate and removed Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug labels Sep 9, 2020
@vasimi
Copy link
Author

vasimi commented Sep 9, 2020

@eps1lon Firefox ignores the srcSets with uppercase letter, not sure about other attributes. I can file a bug in Mozilla's BugZilla, but it would be nice if this was fixed in React, too.

@eps1lon
Copy link
Collaborator

eps1lon commented Sep 9, 2020

I can file a bug in Mozilla's BugZilla,

That's be nice so that we can confirm where the issue originates.

but it would be nice if this was fixed in React, too.

It's not clear if this is actually an issue with React. As said previously: HTML tag names and attribute names are not case-sensitive. User agents should treat srcset and sRcSET equal.

@coreyward
Copy link

It's not clear if this is actually an issue with React. As said previously: HTML tag names and attribute names are not case-sensitive. User agents should treat srcset and sRcSET equal.

There's a long history of adapting to what user agents actually do rather than hiding behind what they should do. I'm a bit confused why React would be continuing to ignore this concern for years. Is there any reason at all whatsoever for the current behavior? It's bizarre that React would both 1) complain about me using a lowercase attribute and 2) tell me I shouldn't care about the casing of the attribute, but here we are.

@edkimmel
Copy link

Chrome appears to also be ignoring srcSet and is loading the src attribute instead off of SSR. When the client re-renders it as srcset it then picks the appropriate size.

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

No branches or pull requests

4 participants