@@ -515,7 +515,6 @@ aria-label="Show hidden lines"></button>';
515515} ) ( ) ;
516516
517517( function sidebar ( ) {
518- const body = document . querySelector ( 'body' ) ;
519518 const sidebar = document . getElementById ( 'sidebar' ) ;
520519 const sidebarLinks = document . querySelectorAll ( '#sidebar a' ) ;
521520 const sidebarToggleButton = document . getElementById ( 'sidebar-toggle' ) ;
@@ -548,7 +547,7 @@ aria-label="Show hidden lines"></button>';
548547 } ) ;
549548
550549 function showSidebar ( ) {
551- body . classList . add ( 'sidebar-visible' ) ;
550+ document . documentElement . classList . add ( 'sidebar-visible' ) ;
552551 Array . from ( sidebarLinks ) . forEach ( function ( link ) {
553552 link . setAttribute ( 'tabIndex' , 0 ) ;
554553 } ) ;
@@ -562,7 +561,7 @@ aria-label="Show hidden lines"></button>';
562561 }
563562
564563 function hideSidebar ( ) {
565- body . classList . remove ( 'sidebar-visible' ) ;
564+ document . documentElement . classList . remove ( 'sidebar-visible' ) ;
566565 Array . from ( sidebarLinks ) . forEach ( function ( link ) {
567566 link . setAttribute ( 'tabIndex' , - 1 ) ;
568567 } ) ;
@@ -594,14 +593,14 @@ aria-label="Show hidden lines"></button>';
594593 function initResize ( ) {
595594 window . addEventListener ( 'mousemove' , resize , false ) ;
596595 window . addEventListener ( 'mouseup' , stopResize , false ) ;
597- body . classList . add ( 'sidebar-resizing' ) ;
596+ document . documentElement . classList . add ( 'sidebar-resizing' ) ;
598597 }
599598 function resize ( e ) {
600599 let pos = e . clientX - sidebar . offsetLeft ;
601600 if ( pos < 20 ) {
602601 hideSidebar ( ) ;
603602 } else {
604- if ( ! body . classList . contains ( 'sidebar-visible' ) ) {
603+ if ( ! document . documentElement . classList . contains ( 'sidebar-visible' ) ) {
605604 showSidebar ( ) ;
606605 }
607606 pos = Math . min ( pos , window . innerWidth - 100 ) ;
@@ -610,7 +609,7 @@ aria-label="Show hidden lines"></button>';
610609 }
611610 //on mouseup remove windows functions mousemove & mouseup
612611 function stopResize ( ) {
613- body . classList . remove ( 'sidebar-resizing' ) ;
612+ document . documentElement . classList . remove ( 'sidebar-resizing' ) ;
614613 window . removeEventListener ( 'mousemove' , resize , false ) ;
615614 window . removeEventListener ( 'mouseup' , stopResize , false ) ;
616615 }
0 commit comments