From: Christopher CHEN Date: Tue, 18 Sep 2018 13:38:13 +0000 (+0800) Subject: DOM not ready when restoring `adminer_tables_filter` (#289) X-Git-Tag: v4.7.0~28 X-Git-Url: https://git.joonet.de/?a=commitdiff_plain;h=84e86cf572a2498f7e3479d97c51c0fadd2e2043;p=adminer.git DOM not ready when restoring `adminer_tables_filter` (#289) Uncaught TypeError: Cannot set property 'value' of null --- 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); -} +});