[assets] Replace inline events with addEventListener; this breaks sliding menu.

This commit is contained in:
Fabien Basmaison 2021-04-06 11:37:23 +02:00
parent 7e49b3cb26
commit 62fe2ef600
2 changed files with 6 additions and 6 deletions

View file

@ -11,23 +11,23 @@ let BookWyrm = new class {
initEventListeners() { initEventListeners() {
// buttons that display or hide content // buttons that display or hide content
document.querySelectorAll('[data-controls]') document.querySelectorAll('[data-controls]')
.forEach(button => button.onclick = this.toggleAction.bind(this)); .forEach(button => button.addEventListener('click', this.toggleAction.bind(this)));
// javascript interactions (boost/fav) // javascript interactions (boost/fav)
document.querySelectorAll('.interaction') document.querySelectorAll('.interaction')
.forEach(button => button.onsubmit = this.interact.bind(this)); .forEach(button => button.addEventListener('submit', this.interact.bind(this)));
// handle aria settings on menus // handle aria settings on menus
document.querySelectorAll('.pulldown-menu') document.querySelectorAll('.pulldown-menu')
.forEach(button => button.onclick = this.toggleMenu.bind(this)); .forEach(button => button.addEventListener('click', this.toggleMenu.bind(this)));
// hidden submit button in a form // hidden submit button in a form
document.querySelectorAll('.hidden-form input') document.querySelectorAll('.hidden-form input')
.forEach(button => button.onchange = this.revealForm.bind(this)); .forEach(button => button.addEventListener('change', this.revealForm.bind(this)));
// browser back behavior // browser back behavior
document.querySelectorAll('[data-back]') document.querySelectorAll('[data-back]')
.forEach(button => button.onclick = this.back); .forEach(button => button.addEventListener('click', this.back));
} }
/** /**

View file

@ -9,7 +9,7 @@ let LocalStorageTools = new class {
// update localstorage // update localstorage
document.querySelectorAll('.set-display') document.querySelectorAll('.set-display')
.forEach(t => t.onclick = this.updateDisplay.bind(this)); .forEach(t => t.addEventListener('click', this.updateDisplay.bind(this)));
} }
// set javascript listeners // set javascript listeners