diff --git a/src/renderers/shared/event/eventPlugins/ResponderTouchHistoryStore.js b/src/renderers/shared/event/eventPlugins/ResponderTouchHistoryStore.js index bf497de37d..973a856f4e 100644 --- a/src/renderers/shared/event/eventPlugins/ResponderTouchHistoryStore.js +++ b/src/renderers/shared/event/eventPlugins/ResponderTouchHistoryStore.js @@ -105,10 +105,10 @@ var recordStartTouchData = function(touch) { if (__DEV__) { validateTouch(touch); } - if (!touchTrack) { - touchBank[touch.identifier] = initializeTouchData(touch); - } else { + if (touchTrack) { reinitializeTouchTrack(touchTrack, touch); + } else { + touchBank[touch.identifier] = initializeTouchData(touch); } touchHistory.mostRecentTimeStamp = timestampForTouch(touch); }; diff --git a/src/shared/utils/Transaction.js b/src/shared/utils/Transaction.js index d26b7a863b..58dd1a26c5 100644 --- a/src/shared/utils/Transaction.js +++ b/src/shared/utils/Transaction.js @@ -84,10 +84,10 @@ var Mixin = { */ reinitializeTransaction: function() { this.transactionWrappers = this.getTransactionWrappers(); - if (!this.wrapperInitData) { - this.wrapperInitData = []; - } else { + if (this.wrapperInitData) { this.wrapperInitData.length = 0; + } else { + this.wrapperInitData = []; } this._isInTransaction = false; }, diff --git a/src/shared/vendor/stubs/EventListener.js b/src/shared/vendor/stubs/EventListener.js index 3f67215d2e..789fc07b56 100644 --- a/src/shared/vendor/stubs/EventListener.js +++ b/src/shared/vendor/stubs/EventListener.js @@ -59,7 +59,14 @@ var EventListener = { * @return {object} Object with a `remove` method. */ capture: function(target, eventType, callback) { - if (!target.addEventListener) { + if (target.addEventListener) { + target.addEventListener(eventType, callback, true); + return { + remove: function () { + target.removeEventListener(eventType, callback, true); + } + }; + } else { if (__DEV__) { console.error( 'Attempted to listen to events during the capture phase on a ' + @@ -70,13 +77,6 @@ var EventListener = { return { remove: emptyFunction }; - } else { - target.addEventListener(eventType, callback, true); - return { - remove: function() { - target.removeEventListener(eventType, callback, true); - } - }; } }, diff --git a/src/test/ReactTestUtils.js b/src/test/ReactTestUtils.js index 8c47175f63..15beda2cab 100644 --- a/src/test/ReactTestUtils.js +++ b/src/test/ReactTestUtils.js @@ -410,7 +410,9 @@ ReactShallowRenderer.prototype.unmount = function() { }; ReactShallowRenderer.prototype._render = function(element, transaction, context) { - if (!this._instance) { + if (this._instance) { + this._instance.receiveComponent(element, transaction, context); + } else { var rootID = ReactInstanceHandles.createReactRootID(); var instance = new ShallowComponentWrapper(element.type); instance.construct(element); @@ -418,8 +420,6 @@ ReactShallowRenderer.prototype._render = function(element, transaction, context) instance.mountComponent(rootID, transaction, context); this._instance = instance; - } else { - this._instance.receiveComponent(element, transaction, context); } };