Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

support customized attibutes and aria-* attributes #23

Merged
merged 1 commit into from
Oct 31, 2015

Conversation

chilijung
Copy link
Contributor

https://facebook.github.io/react/docs/jsx-gotchas.html#custom-html-attributes

Customized attributes like data-custom-attributes are converted into camel case, it should not be converted. So does aria-* attributes.

@Olical
Copy link
Owner

Olical commented Oct 31, 2015

A perfect PR, thanks a lot! I like the look of the changes and the tests, it makes sense to me. If React has this edge case supported then so should we.

Olical added a commit that referenced this pull request Oct 31, 2015
support customized attibutes and aria-* attributes
@Olical Olical merged commit 0e89619 into Olical:master Oct 31, 2015
@@ -88,7 +88,13 @@ Element.prototype.attributeNameMappings = {
}

Element.prototype.attributeToPropName = function (name) {
return this.attributeNameMappings[name] || camelCase(name)
if (name.match(/^data-/)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to mention before I merged it that these RegExps should probably be initialised in a closure (cached and reused).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll send another PR if I have time to fix it. Thanks 👍

@chilijung chilijung deleted the custom-tag branch October 31, 2015 10:42
@Olical
Copy link
Owner

Olical commented Oct 31, 2015

I opened an issue as a reminder, I'll get around to it if not but feel free! :) thanks.

@Olical
Copy link
Owner

Olical commented Nov 3, 2015

Published in v2.1.0

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

Successfully merging this pull request may close these issues.

2 participants