Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Strip whitelist. Move casing warnings to dev tools #6459
I'm sort of hesitant to send out a pull request for this, but a conversation with a co-worker about why React doesn't allow custom attributes (specifically for attribute-based style rules) triggered my curiosity.
This pull request configures
The side-effect of removing properties from the whitelist is that the dev tools no longer warn on casing issues. To get around this, I added some code to the UnknownProperty dev tool for such occurrences.
Conceptually, yes, we would like to do something like this. It is being tracked as #140.
Unfortunately, there is some complexity. We would need to warn for a release for any attributes that are currently being dropped (not on the whitelist, thus not rendered to the DOM). The reason is that some people may use the spread operator to pass along all props, and rely on the whitelist to strip out props that aren't applicable to the DOM node.
If you would like to work on adding that warning, we could take that commit for v16, and then re-consider this PR for v17. The warning would need to have line numbers, so it is likely dependent on the work being done in #6398
I'm going to close this out for now, since it's not actionable for the next major release (or two). I'll mark it as unsolved so we can come back to it at the appropriate time (do remind us if we forget). But the first step is to start warning whenever we drop an attribute and thus don't render it to the DOM.
This is great work though, much appreciated!