aboutsummaryrefslogtreecommitdiff
path: root/ext/js/pages/settings/scan-inputs-simple-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-12-16 19:55:02 -0500
committerGitHub <noreply@github.com>2023-12-17 00:55:02 +0000
commit95ad1ae1ef4a53802c12eab4c9b1545af0333aa1 (patch)
treec08016ccb3265a5931baf413cd9d78fcbf600ae9 /ext/js/pages/settings/scan-inputs-simple-controller.js
parent77d27113d347b4724302f1c72de1f238e04aeead (diff)
Safer query selector (#364)
* Add querySelectorNotNull helper function * Use querySelectorNotNull * Updates * Update settings * Remove unused * Update * Update function calls * More updates * Update types * Remove obsolete code
Diffstat (limited to 'ext/js/pages/settings/scan-inputs-simple-controller.js')
-rw-r--r--ext/js/pages/settings/scan-inputs-simple-controller.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/ext/js/pages/settings/scan-inputs-simple-controller.js b/ext/js/pages/settings/scan-inputs-simple-controller.js
index 8d52af61..ddb68825 100644
--- a/ext/js/pages/settings/scan-inputs-simple-controller.js
+++ b/ext/js/pages/settings/scan-inputs-simple-controller.js
@@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import {querySelectorNotNull} from '../../dom/query-selector.js';
import {HotkeyUtil} from '../../input/hotkey-util.js';
import {yomitan} from '../../yomitan.js';
import {ScanInputsController} from './scan-inputs-controller.js';
@@ -27,10 +28,10 @@ export class ScanInputsSimpleController {
constructor(settingsController) {
/** @type {import('./settings-controller.js').SettingsController} */
this._settingsController = settingsController;
- /** @type {?HTMLInputElement} */
- this._middleMouseButtonScan = null;
- /** @type {?HTMLSelectElement} */
- this._mainScanModifierKeyInput = null;
+ /** @type {HTMLInputElement} */
+ this._middleMouseButtonScan = querySelectorNotNull(document, '#middle-mouse-button-scan');
+ /** @type {HTMLSelectElement} */
+ this._mainScanModifierKeyInput = querySelectorNotNull(document, '#main-scan-modifier-key');
/** @type {boolean} */
this._mainScanModifierKeyInputHasOther = false;
/** @type {HotkeyUtil} */
@@ -39,9 +40,6 @@ export class ScanInputsSimpleController {
/** */
async prepare() {
- this._middleMouseButtonScan = /** @type {HTMLInputElement} */ (document.querySelector('#middle-mouse-button-scan'));
- this._mainScanModifierKeyInput = /** @type {HTMLSelectElement} */ (document.querySelector('#main-scan-modifier-key'));
-
const {platform: {os}} = await yomitan.api.getEnvironmentInfo();
this._hotkeyUtil.os = os;