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

add "data-" prefix for custom attributes #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hellopao
Copy link

No description provided.

@Daniel15
Copy link
Member

I'm not sure this is a good idea... I don't think a user will expect <div foo="bar"> to be transformed to <div data-foo="bar">. If you want to do that, the source should be<div data-foo="bar"> already. I don't like the idea of magically renaming things 😄

@ssorallen
Copy link
Contributor

ssorallen commented Apr 25, 2016

I agree no renaming should happen, but these are problematic for React. Attributes are whitelisted for known HTML elements. React is fine with custom elements, elements containing at least one dash in their name, having random attributes but non-whitelisted attributes are treated as props.

@hellopao
Copy link
Author

@Daniel15 when using custom attributes in react, these attributes will be removed after rendering, to solve this problem, react supports all data-* and aria-* attributes

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions.

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

Successfully merging this pull request may close these issues.

4 participants