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

renderToStaticMarkup incorrectly renders async attribute #11624

Closed
clementallen opened this issue Nov 22, 2017 · 3 comments
Closed

renderToStaticMarkup incorrectly renders async attribute #11624

clementallen opened this issue Nov 22, 2017 · 3 comments

Comments

@clementallen
Copy link

Do you want to request a feature or report a bug?
Bug

What is the current behaviour?
The async tag is rendered with a value of empty quotes like so: <script async="" src={url}></script>

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem:
http://jsfiddle.net/twceacmz/
Note: The fiddle adds the async tag to a div because script tags aren't allowed. The behaviour is exactly the same.

What is the expected behavior?
The async tag should be rendered with no quotes like so: <script async src={url}></script>

Using react-dom's render method the async tag works as expected - its only with react-dom/server's renderToStaticMarkup method that the behaviour is different.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
Latest

@gaearon
Copy link
Collaborator

gaearon commented Nov 22, 2017

Does this break the code? Boolean attributes can be emitted with ="" per spec as far as I know.

@clementallen
Copy link
Author

@gaearon no it doesn't appear to break the code, but surely both methods should behave the same when outputting boolean attributes? Feel free to close if unnecessary.

@gaearon
Copy link
Collaborator

gaearon commented Nov 22, 2017

AFAIK async="" is a valid way to write it so I'll close this. If you feel strongly about this though feel free to send a PR that removes empty quotes for such cases (booleans only I think).

@gaearon gaearon closed this as completed Nov 22, 2017
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

2 participants