assets/js/plugins/gumshoe.js in minimal-mistakes-jekyll-4.16.2 vs assets/js/plugins/gumshoe.js in minimal-mistakes-jekyll-4.16.3

- old
+ new

@@ -1,7 +1,7 @@ /*! - * gumshoejs v5.1.0 + * gumshoejs v5.1.1 * A simple, framework-agnostic scrollspy script. * (c) 2019 Chris Ferdinandi * MIT License * http://github.com/cferdinandi/gumshoe */ @@ -106,16 +106,18 @@ /** * Sort content from first to last in the DOM * @param {Array} contents The content areas */ var sortContents = function (contents) { - contents.sort((function (item1, item2) { - var offset1 = getOffsetTop(item1.content); - var offset2 = getOffsetTop(item2.content); - if (offset1 < offset2) return -1; - return 1; - })); + if(contents) { + contents.sort((function (item1, item2) { + var offset1 = getOffsetTop(item1.content); + var offset2 = getOffsetTop(item2.content); + if (offset1 < offset2) return -1; + return 1; + })); + } }; /** * Get the offset to use for calculating position * @param {Object} settings The settings for this instantiation @@ -407,11 +409,11 @@ window.cancelAnimationFrame(timeout); } // Setup debounce callback timeout = window.requestAnimationFrame((function () { - sortContents(); + sortContents(contents); publicAPIs.detect(); })); }; @@ -420,10 +422,10 @@ */ publicAPIs.destroy = function () { // Undo DOM changes if (current) { - deactivate(current); + deactivate(current, settings); } // Remove event listeners window.removeEventListener('scroll', scrollHandler, false); if (settings.reflow) { \ No newline at end of file