From ce8c51f8d3c26723c134e23002e7f5195f7b8c68 Mon Sep 17 00:00:00 2001 From: Georgios Giannoutsos Barkas Date: Fri, 13 Oct 2017 16:14:21 +0200 Subject: [PATCH 1/4] Accept React attributes on custom components --- src/renderers/dom/fiber/ReactDOMFiberComponent.js | 6 +++++- .../dom/shared/__tests__/DOMPropertyOperations-test.js | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/renderers/dom/fiber/ReactDOMFiberComponent.js b/src/renderers/dom/fiber/ReactDOMFiberComponent.js index a98800329222b..c444505bd964d 100644 --- a/src/renderers/dom/fiber/ReactDOMFiberComponent.js +++ b/src/renderers/dom/fiber/ReactDOMFiberComponent.js @@ -298,7 +298,11 @@ function setInitialDOMProperties( ensureListeningTo(rootContainerElement, propKey); } } else if (isCustomComponentTag) { - DOMPropertyOperations.setValueForAttribute(domElement, propKey, nextProp); + if ((DOMProperty.getPropertyInfo(propKey))) { + DOMPropertyOperations.setValueForProperty(domElement, propKey, nextProp); + } else { + DOMPropertyOperations.setValueForAttribute(domElement, propKey, nextProp); + } } else if (nextProp != null) { // If we're updating to null or undefined, we should remove the property // from the DOM node instead of inadvertently setting to a string. This diff --git a/src/renderers/dom/shared/__tests__/DOMPropertyOperations-test.js b/src/renderers/dom/shared/__tests__/DOMPropertyOperations-test.js index 7f544506a5f35..9c28023f2670e 100644 --- a/src/renderers/dom/shared/__tests__/DOMPropertyOperations-test.js +++ b/src/renderers/dom/shared/__tests__/DOMPropertyOperations-test.js @@ -113,6 +113,12 @@ describe('DOMPropertyOperations', () => { ReactDOM.render(