File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 100100
101101 var NOOP = function NOOP ( ) { } ;
102102
103- var PASSIVE = { passive : true } ;
103+ // If a browser doesn't support the `options` argument to
104+ // add/removeEventListener, we need to check, otherwise we will
105+ // accidentally set `capture` with a truthy value.
106+ var PASSIVE = function ( ) {
107+ if ( typeof window === 'undefined' ) return false ;
108+ var hasSupport = false ;
109+ try {
110+ document . createElement ( 'div' ) . addEventListener ( 'test' , NOOP , {
111+ get passive ( ) {
112+ hasSupport = true ;
113+ return false ;
114+ }
115+ } ) ;
116+ } catch ( e ) { }
117+ return hasSupport ;
118+ } ( ) ? { passive : true } : false ;
104119
105120 _module3 . default . exports = ( _temp = _class = function ( _Component ) {
106121 _inherits ( ReactList , _Component ) ;
157172 key : 'componentWillUnmount' ,
158173 value : function componentWillUnmount ( ) {
159174 window . removeEventListener ( 'resize' , this . updateFrame ) ;
160- this . scrollParent . removeEventListener ( 'scroll' , this . updateFrame ) ;
161- this . scrollParent . removeEventListener ( 'mousewheel' , NOOP ) ;
175+ this . scrollParent . removeEventListener ( 'scroll' , this . updateFrame , PASSIVE ) ;
176+ this . scrollParent . removeEventListener ( 'mousewheel' , NOOP , PASSIVE ) ;
162177 }
163178 } , {
164179 key : 'getOffset' ,
You can’t perform that action at this time.
0 commit comments