Skip to content

Commit

Permalink
Disable synchronous scroll event handling for all the newer browsers.
Browse files Browse the repository at this point in the history
Basically facebook#2271
  • Loading branch information
ashtuchkin committed Nov 15, 2014
1 parent 3401a77 commit abb0929
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/browser/ReactBrowserEventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit abb0929

Please sign in to comment.