From 84e86cf572a2498f7e3479d97c51c0fadd2e2043 Mon Sep 17 00:00:00 2001 From: Christopher CHEN Date: Tue, 18 Sep 2018 21:38:13 +0800 Subject: [PATCH] DOM not ready when restoring `adminer_tables_filter` (#289) Uncaught TypeError: Cannot set property 'value' of null --- plugins/tables-filter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/tables-filter.php b/plugins/tables-filter.php index e7abe6fd..ab716531 100644 --- a/plugins/tables-filter.php +++ b/plugins/tables-filter.php @@ -53,7 +53,7 @@ function tablesFilterInput() { tablesFilterTimeout = window.setTimeout(tablesFilter, 200); } -if (sessionStorage){ +sessionStorage && document.addEventListener('DOMContentLoaded', function () { var db = qs('#dbs').querySelector('select'); db = db.options[db.selectedIndex].text; if (db == sessionStorage.getItem('adminer_tables_filter_db') && sessionStorage.getItem('adminer_tables_filter')){ @@ -61,7 +61,7 @@ if (sessionStorage){ tablesFilter(); } sessionStorage.setItem('adminer_tables_filter_db', db); -} +});