From f6dd6ef772b04db76c4823cf48c688a64c3862b9 Mon Sep 17 00:00:00 2001 From: "Fabio M. Costa" Date: Wed, 12 Nov 2014 00:08:30 -0800 Subject: [PATCH] Removing unecessary resize listener monitorScrollValue is only called with `ViewportMetrics.refreshScrollValues` (https://github.com/facebook/react/blob/master/src/browser/ReactBrowserEventEmitter.js#L333-L334) and the window scroll properties (scrollTop and scrollLeft) don't change on resize (from my testings), so there is no need to listen for window resizes. I also tried to see why the resize listener was added from the history but it was introduced on the initial commits. I created a simple page that shows that http://jsbin.com/nuhice, open the console. --- src/browser/ui/ReactEventListener.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/browser/ui/ReactEventListener.js b/src/browser/ui/ReactEventListener.js index e51fcd9c62..25ba525027 100644 --- a/src/browser/ui/ReactEventListener.js +++ b/src/browser/ui/ReactEventListener.js @@ -157,7 +157,6 @@ var ReactEventListener = { monitorScrollValue: function(refresh) { var callback = scrollValueMonitor.bind(null, refresh); EventListener.listen(window, 'scroll', callback); - EventListener.listen(window, 'resize', callback); }, dispatchEvent: function(topLevelType, nativeEvent) {