-
-
Notifications
You must be signed in to change notification settings - Fork 350
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
Property-names get lower-cased? #46
Comments
Attribute names are automatically lowercase, which is a requirement of HTML We should use React may also remove className from the React Fire, making it more modern and standard in lowercase and less expensive. |
Yes, for attributes - I brought this up earlier here. JSX attributes generally map to object properties first - and to HTML attributes only as a fallback. This is true in React and most React-likes. For example, here you can see Preact prefers object properties: https://github.com/preactjs/preact/blob/master/src/diff/props.js#L97 As does Superfine: https://github.com/jorgebucaran/superfine/blob/master/src/index.js#L33 The issue here is type-safety. Attributes do not have types - they're always strings, while the values you work with in JS have other types. For example, This is why JSX attributes map to properties and only fall back to attributes.
When properties and attributes are supported, you can use either. 🙂
You don't have to do anything to make that work - in current versions of React,
This is similar to what Preact does already: https://github.com/preactjs/preact/blob/master/src/diff/props.js#L47 It just changes Anyhow, I understand the problem now: properties aren't supported at all right now, and the browser normalizes I'll see about adding some tests for this and submit another PR. 👍 |
Looking forward to refactoring here, becoming safer and tinyer! |
It looks like property-names are getting lower-cased?
For example,
<div className="red">
gets rendered as<div classname="red">
, which doesn't work, since the property-names are case-sensitive:I've been looking through the code, and can't figure out where or how this happens.
If I take the same example and import
h
andrender
from e.g.preact
, it works fine, so I don't think it's CodeSandbox mangling the code or something? 🤔I only see one call to
toLowerCase()
in the code, and it applies only to event-handlers.Any ideas?
The text was updated successfully, but these errors were encountered: