DOM not ready when restoring adminer_tables_filter (#289)

Uncaught TypeError: Cannot set property 'value' of null
This commit is contained in:
Christopher CHEN 2018-09-18 21:38:13 +08:00 committed by Jakub Vrána
parent 1ce5b5ad31
commit 84e86cf572

View file

@ -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);
}
});
</script>
<p class="jsonly"><input id="filter-field" autocomplete="off"><?php echo script("qs('#filter-field').oninput = tablesFilterInput;"); ?>
<?php