File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
core/pfe-core/controllers Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change 11import type { ReactiveController , ReactiveControllerHost } from 'lit' ;
22
3+ import { isServer } from 'lit' ;
4+
35export interface ScrollSpyControllerOptions extends IntersectionObserverInit {
46 /**
57 * Tag names of legal link children.
@@ -33,13 +35,15 @@ export class ScrollSpyController implements ReactiveController {
3335 static #instances = new Set < ScrollSpyController > ;
3436
3537 static {
36- addEventListener ( 'scroll' , ( ) => {
37- if ( Math . round ( window . innerHeight + window . scrollY ) >= document . body . scrollHeight ) {
38- this . #instances. forEach ( ssc => {
39- ssc . #setActive( ssc . #linkChildren. at ( - 1 ) ) ;
40- } ) ;
41- }
42- } , { passive : true } ) ;
38+ if ( ! isServer ) {
39+ addEventListener ( 'scroll' , ( ) => {
40+ if ( Math . round ( window . innerHeight + window . scrollY ) >= document . body . scrollHeight ) {
41+ this . #instances. forEach ( ssc => {
42+ ssc . #setActive( ssc . #linkChildren. at ( - 1 ) ) ;
43+ } ) ;
44+ }
45+ } , { passive : true } ) ;
46+ }
4347 }
4448
4549 #tagNames: string [ ] ;
You can’t perform that action at this time.
0 commit comments