File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ var TableOfContents = Control.extend({
33
33
this . scroller = document . body ;
34
34
this . container = this . element . parentNode ;
35
35
36
- this . depth = window . docObject . outline && window . docObject . outline . depth || 1 ;
36
+ var depth = window . docObject . outline && window . docObject . outline . depth ;
37
+ this . depth = typeof depth === "number" ? depth : 1 ;
37
38
38
39
this . navHeight = this . getNavHeight ( ) ;
39
40
this . titles = this . collectTitles ( ) ;
@@ -94,7 +95,7 @@ var TableOfContents = Control.extend({
94
95
return "article " + h ;
95
96
} ) . join ( "," ) ;
96
97
97
- var titles = document . querySelectorAll ( selector ) ;
98
+ var titles = selector ? document . querySelectorAll ( selector ) : [ ] ;
98
99
var curScroll = this . scroller . scrollTop ;
99
100
var navHeight = this . navHeight ;
100
101
return [ ] . map . call ( titles , function ( title , idx ) {
You can’t perform that action at this time.
0 commit comments