From 5a431a12ace4a705d50ba087caaf78a6b01ce546 Mon Sep 17 00:00:00 2001 From: Michael Ridgway Date: Mon, 13 Apr 2015 14:17:16 -0700 Subject: [PATCH 1/2] Replace hasOwnProperty in child processing with typeof undefined check --- src/utils/ReactChildren.js | 2 +- src/utils/flattenChildren.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/ReactChildren.js b/src/utils/ReactChildren.js index 4109557dde9..0589c8eafe4 100644 --- a/src/utils/ReactChildren.js +++ b/src/utils/ReactChildren.js @@ -81,7 +81,7 @@ function mapSingleChildIntoContext(traverseContext, child, name, i) { var mapBookKeeping = traverseContext; var mapResult = mapBookKeeping.mapResult; - var keyUnique = !mapResult.hasOwnProperty(name); + var keyUnique = ('undefined' === typeof mapResult[name]); if (__DEV__) { warning( keyUnique, diff --git a/src/utils/flattenChildren.js b/src/utils/flattenChildren.js index 5d8ee72b445..21dc674d814 100644 --- a/src/utils/flattenChildren.js +++ b/src/utils/flattenChildren.js @@ -22,7 +22,7 @@ var warning = require('warning'); function flattenSingleChildIntoContext(traverseContext, child, name) { // We found a component instance. var result = traverseContext; - var keyUnique = !result.hasOwnProperty(name); + var keyUnique = ('undefined' === typeof result[name]); if (__DEV__) { warning( keyUnique, From ed70d35e18e87c7012e4ed43145934399cb4aab4 Mon Sep 17 00:00:00 2001 From: Michael Ridgway Date: Tue, 14 Apr 2015 14:37:50 -0700 Subject: [PATCH 2/2] Update code style --- src/utils/ReactChildren.js | 2 +- src/utils/flattenChildren.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/ReactChildren.js b/src/utils/ReactChildren.js index 0589c8eafe4..e470609bc74 100644 --- a/src/utils/ReactChildren.js +++ b/src/utils/ReactChildren.js @@ -81,7 +81,7 @@ function mapSingleChildIntoContext(traverseContext, child, name, i) { var mapBookKeeping = traverseContext; var mapResult = mapBookKeeping.mapResult; - var keyUnique = ('undefined' === typeof mapResult[name]); + var keyUnique = (mapResult[name] === undefined); if (__DEV__) { warning( keyUnique, diff --git a/src/utils/flattenChildren.js b/src/utils/flattenChildren.js index 21dc674d814..3a5464d0570 100644 --- a/src/utils/flattenChildren.js +++ b/src/utils/flattenChildren.js @@ -22,7 +22,7 @@ var warning = require('warning'); function flattenSingleChildIntoContext(traverseContext, child, name) { // We found a component instance. var result = traverseContext; - var keyUnique = ('undefined' === typeof result[name]); + var keyUnique = (result[name] === undefined); if (__DEV__) { warning( keyUnique,