Don't throw for onClick={false} in initial render
I accidentally regressed this in #3246. Now this matches what we already checked for updates.
Ben Alpert committed
Sep 30, 2015 at 16:53 UTC
2b6360147262b3b81c49ff5ebe6d851bde8a622d
2 files changed
+7
-1
src/renderers/dom/shared/ReactDOMComponent.js
+3
-1
@@ -656,7 +656,9 @@ ReactDOMComponent.Mixin = {
656
continue;
657
}
658
if (registrationNameModules.hasOwnProperty(propKey)) {
659
- enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
659
+ if (propValue) {
660
+ enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
661
+ }
662
} else {
663
if (propKey === STYLE) {
664
if (propValue) {
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
+4
@@ -630,6 +630,10 @@ describe('ReactDOMComponent', function() {
630
SimpleEventPlugin.willDeleteListener = mocks.getMockFunction();
631
var container = document.createElement('div');
632
633
+ ReactDOM.render(<div onClick={false} />, container);
634
+ expect(SimpleEventPlugin.didPutListener.mock.calls.length).toBe(0);
635
+ expect(SimpleEventPlugin.willDeleteListener.mock.calls.length).toBe(0);
636
+
637
ReactDOM.render(<div onClick={null} />, container);
638
expect(SimpleEventPlugin.didPutListener.mock.calls.length).toBe(0);
639
expect(SimpleEventPlugin.willDeleteListener.mock.calls.length).toBe(0);