Accept className in ReactDOMFiber
This isn't a complete solution to all attributes. It's just that we run a lot of unrelated unit tests by testing className so we need it for the tests.
Sebastian Markbage committed
Oct 22, 2016 at 17:57 UTC
51f1205fb4fd6402b155202263ee12571ca4c3a6
1 file changed
+7
-1
src/renderers/dom/fiber/ReactDOMFiber.js
+7
-1
@@ -22,7 +22,7 @@ var warning = require('warning');
22
type DOMContainerElement = Element & { _reactRootContainer: ?Object };
23
24
type Container = Element;
25
-type Props = { };
25
+type Props = { className ?: string };
26
type Instance = Element;
27
type TextInstance = Text;
28
@@ -54,6 +54,9 @@ var DOMRenderer = ReactFiberReconciler({
54
createInstance(type : string, props : Props, children : HostChildren<Instance | TextInstance>) : Instance {
55
const domElement = document.createElement(type);
56
recursivelyAppendChildren(domElement, children);
57
+ if (typeof props.className !== 'undefined') {
58
+ domElement.className = props.className;
59
+ }
60
if (typeof props.children === 'string') {
61
domElement.textContent = props.children;
62
} else if (typeof props.children === 'number') {
@@ -71,6 +74,9 @@ var DOMRenderer = ReactFiberReconciler({
74
},
75
76
commitUpdate(domElement : Instance, oldProps : Props, newProps : Props) : void {
77
+ if (typeof newProps.className !== 'undefined') {
78
+ domElement.className = newProps.className;
79
+ }
80
if (typeof newProps.children === 'string') {
81
domElement.textContent = newProps.children;
82
} else if (typeof newProps.children === 'number') {