diff --git a/src/browser/ReactBrowserEventEmitter.js b/src/browser/ReactBrowserEventEmitter.js index f2c4a5dd783ea..712c0f4bec595 100644 --- a/src/browser/ReactBrowserEventEmitter.js +++ b/src/browser/ReactBrowserEventEmitter.js @@ -76,6 +76,7 @@ var isEventSupported = require('isEventSupported'); * React Core . General Purpose Event Plugin System */ +var hasEventPageXY; var alreadyListeningTo = {}; var isMonitoringScrollValue = false; var reactTopListenersCounter = 0; @@ -324,12 +325,19 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, { * Listens to window scroll and resize events. We cache scroll values so that * application code can access them without triggering reflows. * + * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when + * pageX/pageY isn't supported (legacy browsers). + * * NOTE: Scroll events do not bubble. * * @see http://www.quirksmode.org/dom/events/scroll.html */ ensureScrollValueMonitoring: function(){ - if (!isMonitoringScrollValue) { + if (hasEventPageXY === undefined) { + hasEventPageXY = + document.createEvent && 'pageX' in document.createEvent('MouseEvent'); + } + if (!hasEventPageXY && !isMonitoringScrollValue) { var refresh = ViewportMetrics.refreshScrollValues; ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh); isMonitoringScrollValue = true;