@@ -75,7 +75,7 @@ var $articleContainer,
7575 setInterval ( function ( ) {
7676 toggleNav ( ) ;
7777 } , 200 ) ;
78-
78+
7979 scrollToCurrentMenuItem ( ) ;
8080} ) ( ) ;
8181
@@ -216,9 +216,9 @@ function navigate(href, updateLocation) {
216216 return xhr ;
217217 } ,
218218 success : function ( content ) {
219-
219+
220220 if ( updateLocation !== false ) {
221- window . history . pushState ( null , null , href ) ;
221+ window . history . pushState ( null , null , href ) ;
222222 }
223223
224224 // Google Analytics
@@ -241,10 +241,12 @@ function navigate(href, updateLocation) {
241241
242242 //if any page doesn't have a nav, replacing it won't work,
243243 //and the nav will be gone for any subsequent page visits
244- if ( $navReplace && $navReplace . length ) {
245- $navReplace . replaceWith ( $nav ) ;
246- } else {
247- $ ( ".bottom-left" ) . append ( $nav ) ;
244+ if ( $nav && $nav . length ) {
245+ if ( $navReplace && $navReplace . length ) {
246+ $navReplace . replaceWith ( $nav ) ;
247+ } else {
248+ $ ( ".bottom-left" ) . append ( $nav ) ;
249+ }
248250 }
249251 $ ( "article" ) . replaceWith ( $article ) ;
250252 $ ( ".breadcrumb" ) . replaceWith ( $breadcrumb ) ;
@@ -496,4 +498,4 @@ function buildTOC() {
496498
497499 toc += Array ( level - baseLevel + 1 ) . join ( '</li></ol>' ) + "</li></ol>" ;
498500 $tableOfContents . append ( toc ) ;
499- }
501+ }
0 commit comments