Skip to content

Commit 5ed2d6d

Browse files
derojeherve
authored andcommitted
[not verified] Fix: When footer is not enabled, avoid JS errors (#15365)
1 parent 8a338c1 commit 5ed2d6d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

modules/infinite-scroll/infinity.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@
202202
var blog = document.getElementById( 'infinity-blog-title' );
203203
var self = this;
204204

205+
if ( ! blog ) {
206+
return;
207+
}
208+
205209
blog.setAttribute( 'title', totop );
206210
blog.addEventListener( 'click', function( e ) {
207211
var sourceScroll = self.window.pageYOffset;
@@ -223,7 +227,12 @@
223227
footerContainer,
224228
width,
225229
sourceBottom,
226-
targetBottom;
230+
targetBottom,
231+
footerEnabled = this.footer && this.footer.el;
232+
233+
if ( ! footerEnabled ) {
234+
return;
235+
}
227236

228237
// Check if we have an id for the page wrapper
229238
if ( 'string' === typeof this.footer.wrap ) {

0 commit comments

Comments
 (0)