File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " docsify-sidebar-collapse" ,
3- "version" : " 1.0.4 " ,
3+ "version" : " 1.0.6 " ,
44 "description" : " sidebar-collapse plugin for docsify" ,
55 "main" : " src" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -4,14 +4,16 @@ $docsify.plugins = [
44 function ( hook , vm ) {
55 hook . doneEach ( function ( html , next ) {
66 let el = document . querySelector ( '.sidebar-nav .active' ) ;
7- el . classList . add ( 'open' ) ;
8- while ( el && el . className !== 'sidebar-nav' ) {
9- if ( el . parentElement . tagName === 'LI' ) {
10- el . parentElement . className = 'open' ;
7+ if ( el ) {
8+ el . classList . add ( 'open' ) ;
9+ while ( el . className !== 'sidebar-nav' ) {
10+ if ( el . parentElement . tagName === 'LI' ) {
11+ el . parentElement . className = 'open' ;
12+ }
13+ el = el . parentElement ;
1114 }
12- el = el . parentElement ;
1315 }
1416 next ( html ) ;
1517 } ) ;
16- } ,
18+ }
1719] . concat ( $docsify . plugins || [ ] ) ;
You can’t perform that action at this time.
0 commit comments