File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -132,18 +132,20 @@ export class ScrollView {
132
132
this . _cb = onScrollCallback ;
133
133
this . _pos = [ ] ;
134
134
135
- this . _el . addEventListener ( 'touchstart' , this . _start . bind ( this ) ) ;
136
- this . _el . addEventListener ( 'touchmove' , this . _move . bind ( this ) ) ;
137
- this . _el . addEventListener ( 'touchend' , this . _end . bind ( this ) ) ;
138
-
139
- this . _el . parentElement . classList . add ( 'js-scroll' ) ;
135
+ if ( this . _el ) {
136
+ this . _el . addEventListener ( 'touchstart' , this . _start . bind ( this ) ) ;
137
+ this . _el . addEventListener ( 'touchmove' , this . _move . bind ( this ) ) ;
138
+ this . _el . addEventListener ( 'touchend' , this . _end . bind ( this ) ) ;
139
+ this . _el . parentElement . classList . add ( 'js-scroll' ) ;
140
+ }
140
141
141
142
return ( ) => {
142
- this . _el . removeEventListener ( 'touchstart' , this . _start . bind ( this ) ) ;
143
- this . _el . removeEventListener ( 'touchmove' , this . _move . bind ( this ) ) ;
144
- this . _el . removeEventListener ( 'touchend' , this . _end . bind ( this ) ) ;
145
-
146
- this . _el . parentElement . classList . remove ( 'js-scroll' ) ;
143
+ if ( this . _el ) {
144
+ this . _el . removeEventListener ( 'touchstart' , this . _start . bind ( this ) ) ;
145
+ this . _el . removeEventListener ( 'touchmove' , this . _move . bind ( this ) ) ;
146
+ this . _el . removeEventListener ( 'touchend' , this . _end . bind ( this ) ) ;
147
+ this . _el . parentElement . classList . remove ( 'js-scroll' ) ;
148
+ }
147
149
} ;
148
150
}
149
151
You can’t perform that action at this time.
0 commit comments