From c699fe5b5da482aa2e89c7a01857aa28ad2a9f1e Mon Sep 17 00:00:00 2001 From: Domizio Demichelis Date: Tue, 2 Jul 2019 09:41:48 +0200 Subject: [PATCH] fix for javascript/turbolink nav.render firing when element not found (#163) --- lib/javascripts/pagy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/javascripts/pagy.js b/lib/javascripts/pagy.js index 7ec388827..c912ae98a 100644 --- a/lib/javascripts/pagy.js +++ b/lib/javascripts/pagy.js @@ -22,6 +22,7 @@ Pagy.nav = function(id, tags, sequels, param){ widths.sort(function(a, b){return b-a}); var render = function(){ + if (document.getElementById(id) === null){ return } if (container.clientWidth === 0) { rendering() } var width, i, len; for (i = 0, len = widths.length; i < len; i++) {