chore: clean up input.type property access (#1975)

Follows-up 4218c4ce64.

When accessing the IDL property, values tend to be reflected in a normalised
type and form. In the case of HTMLInputElement.type, this means the
returned value is always one of the supported and canonical lowercase
values regardless of what value the corresponding attribute holds, or
even if the attribute doesn't exist (the default will still be "text").
This commit is contained in:
Timo Tijhof 2021-02-28 22:46:23 +00:00 committed by GitHub
parent b9496c9bca
commit 5573f7cf32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,7 +26,7 @@
const { target, key } = event const { target, key } = event
const isRadio = target && const isRadio = target &&
target.tagName === 'INPUT' && target.tagName === 'INPUT' &&
(target.type || '').toLowerCase() === 'radio' target.type === 'radio'
const isArrow = key === 'ArrowUp' || key === 'ArrowDown' const isArrow = key === 'ArrowUp' || key === 'ArrowDown'
return isRadio && isArrow return isRadio && isArrow
} }