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

allow the use of 'class' in custom-elements #191

Closed
nippur72 opened this issue Sep 6, 2016 · 0 comments
Closed

allow the use of 'class' in custom-elements #191

nippur72 opened this issue Sep 6, 2016 · 0 comments

Comments

@nippur72
Copy link
Contributor

nippur72 commented Sep 6, 2016

Since react-templates automatically turns the class attribute into className it's not possible to define a working class attribute on custom elements (e.g. WebComponents).

Example:

<my-div class="red"></my-div>

generates:

var templateRT = function () {
    return React.createElement('my-div', { 'className': 'red' });
};

which doesn't work because custom elements in react expect a class attribute instead of className, as explained in facebook/react#4933:

TLDR: Custom elements DO work in React. You must use class instead of className because the custom element spec requires that we allow users to specify a className attribute and we need to preserve that functionality for custom elements.

As a fix for this, I suggest that we map back className into class for custom elements.

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

No branches or pull requests

1 participant