1
0
mirror of https://github.com/bobwen-dev/react-templates synced 2025-04-12 00:56:39 +02:00

support "for" attribute in react templates

Add support for using "for" attribute and converting it to DOM API supported "htmlFor"
This commit is contained in:
Liad Yosef 2015-04-28 12:47:11 +03:00
parent a0e30d5441
commit 2114f5705e

View File

@ -78,7 +78,7 @@ var reactSupportedAttributes = ['accept', 'acceptCharset', 'accessKey', 'action'
'max', 'maxLength', 'media', 'mediaGroup', 'method', 'min', 'multiple', 'muted', 'name', 'noValidate', 'open', 'pattern', 'placeholder', 'poster', 'preload', 'radioGroup', 'readOnly', 'rel',
'required', 'role', 'rows', 'rowSpan', 'sandbox', 'scope', 'scrolling', 'seamless', 'selected', 'shape', 'size', 'sizes', 'span', 'spellCheck', 'src', 'srcDoc', 'srcSet', 'start', 'step',
'style', 'tabIndex', 'target', 'title', 'type', 'useMap', 'value', 'width', 'wmode'];
var attributesMapping = {'class': 'className', 'rt-class': 'className'};
var attributesMapping = {'class': 'className', 'rt-class': 'className', 'for': 'htmlFor'};
_.forEach(reactSupportedAttributes, function (attributeReactName) {
if (attributeReactName !== attributeReactName.toLowerCase()) {
attributesMapping[attributeReactName.toLowerCase()] = attributeReactName;