mirror of
https://github.com/bobwen-dev/react-templates
synced 2025-04-12 00:56:39 +02:00
support custom-elements
This commit is contained in:
parent
268ac0a419
commit
5015222f45
@ -236,6 +236,7 @@ function generateProps(node, context) {
|
|||||||
function convertTagNameToConstructor(tagName, context) {
|
function convertTagNameToConstructor(tagName, context) {
|
||||||
var isHtmlTag = _.contains(reactDOMSupport[context.options.targetVersion], tagName);
|
var isHtmlTag = _.contains(reactDOMSupport[context.options.targetVersion], tagName);
|
||||||
if (shouldUseCreateElement(context)) {
|
if (shouldUseCreateElement(context)) {
|
||||||
|
isHtmlTag = isHtmlTag || tagName.match(/^\w+(-\w+)$/);
|
||||||
return isHtmlTag ? "'" + tagName + "'" : tagName;
|
return isHtmlTag ? "'" + tagName + "'" : tagName;
|
||||||
}
|
}
|
||||||
return isHtmlTag ? 'React.DOM.' + tagName : tagName;
|
return isHtmlTag ? 'React.DOM.' + tagName : tagName;
|
||||||
|
3
test/data/custom-element.rt
Normal file
3
test/data/custom-element.rt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<div>
|
||||||
|
<custom-element></custom-element>
|
||||||
|
</div>
|
1
test/data/custom-element.rt.html
Normal file
1
test/data/custom-element.rt.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<div><custom-element></custom-element></div>
|
@ -113,7 +113,7 @@ function normalizeHtml(html) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test('html tests', function (t) {
|
test('html tests', function (t) {
|
||||||
var files = ['scope.rt', 'lambda.rt', 'eval.rt', 'props.rt'];
|
var files = ['scope.rt', 'lambda.rt', 'eval.rt', 'props.rt','custom-element.rt'];
|
||||||
t.plan(files.length);
|
t.plan(files.length);
|
||||||
|
|
||||||
files.forEach(check);
|
files.forEach(check);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user