Skip to content

Commit 2b96174

Browse files
committed
Properly handle text nodes and allow htmltools tags
1 parent 184e728 commit 2b96174

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

inst/www/react-tools/react-tools.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ window.reactR = (function () {
1111
&& !components.hasOwnProperty(tag.name)) {
1212
throw new Error("Unknown component: " + tag.name);
1313
}
14-
var args = [components[tag.name], tag.attribs];
14+
var elem = components.hasOwnProperty(tag.name) ? components[tag.name] : tag.name,
15+
args = [elem, tag.attribs];
1516
for (var i = 0; i < tag.children.length; i++) {
16-
args.push(hydrate(components, tag.children[i]));
17+
if (typeof tag.children[i] === 'string') {
18+
args.push(tag.children[i]);
19+
} else {
20+
args.push(hydrate(components, tag.children[i]));
21+
}
1722
}
1823
return React.createElement.apply(null, args);
1924
}

0 commit comments

Comments
 (0)