Skip to content

Commit

Permalink
Add modifier keys constant
Browse files Browse the repository at this point in the history
  • Loading branch information
asamuzaK committed Sep 14, 2024
1 parent e7abc2d commit 6389cc7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/js/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,7 @@ export const KEY_INPUT_LTR = Object.freeze([
'checkbox', 'color', 'date', 'image', 'number', 'range', 'radio', 'time'
]);
export const KEY_LOGICAL = Object.freeze(['has', 'is', 'not', 'where']);
export const KEY_MODIFIER = Object.freeze([
'Alt', 'AltGraph', 'CapsLock', 'Control', 'Fn', 'FnLock', 'Hyper', 'Meta',
'NumLock', 'ScrollLock', 'Shift', 'Super', 'Symbol', 'SymbolLock'
]);
9 changes: 2 additions & 7 deletions src/js/finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import {
ATTR_SELECTOR, BIT_01, CLASS_SELECTOR, COMBINATOR, DOCUMENT_FRAGMENT_NODE,
DOCUMENT_NODE, ELEMENT_NODE, ID_SELECTOR, KEY_FORM_FOCUS, KEY_INPUT_DATE,
KEY_INPUT_EDIT, KEY_INPUT_TEXT, KEY_LOGICAL, NOT_SUPPORTED_ERR,
KEY_INPUT_EDIT, KEY_INPUT_TEXT, KEY_LOGICAL, KEY_MODIFIER, NOT_SUPPORTED_ERR,
PS_CLASS_SELECTOR, PS_ELEMENT_SELECTOR, SHOW_ALL, SYNTAX_ERR, TARGET_ALL,
TARGET_FIRST, TARGET_LINEAL, TARGET_SELF, TEXT_NODE, TYPE_SELECTOR,
WALKER_FILTER
Expand Down Expand Up @@ -166,12 +166,7 @@ export class Finder {
for (const key of keyboardKeys) {
func.push(this.#window.addEventListener(key, evt => {
const { key } = evt;
const specialKeys = [
'Alt', 'AltGraph', 'CapsLock', 'Control', 'Dead', 'Fn', 'FnLock',
'Hyper', 'Meta', 'NumLock', 'ScrollLock', 'Shift', 'Super', 'Symbol',
'SymbolLock', 'Unidentified'
];
if (!specialKeys.includes(key)) {
if (!KEY_MODIFIER.includes(key)) {
this.#event = evt;
}
}, opt));
Expand Down

0 comments on commit 6389cc7

Please sign in to comment.