-
Notifications
You must be signed in to change notification settings - Fork 312
Closed
Description
F99 mentions to beware "the presence of the .keycode
attribute".
- That looks like a DOM property accessor, and to the best of my knowledge, there is no (.)keycode attribute, assuming HTML is the host language. Note that DOM property accessors might yield different results than the
getAttribute
method for the reflected attribute. - DOM property names are case sensitive:
keyCode
. keyCode
has been deprecated since, eh, I'm not an archeologist. :-) A superficial search unveils a Stackoverflow question from 2016.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
bruce-usab commentedon Apr 16, 2025
It looks to me like “the .keycode attribute” could be replaced by “event.key” -- but that is not an ambitious fix.
besenwagen commentedon Apr 16, 2025
IMO the minimal and least controversial viable fix would be just "
.keyCode
property" instead of ".keycode
attribute". Just for accuracy. It can still be found in the wild, and it probably still works. It's anachronistic alright, but then, event handling nowadays is usually buried under a thick layer of "normalization" by libraries or frameworks. I doubt that this kind of code search is useful with eventTarget abstractions.Using
event
as an identifier without full context in documentation examples is historically burdened and should be used with caution. Internet Explorer thought it would be cute to have a globalevent
object without passing it into a handler function or method, and its lifeline was extended via the original Opera to present day Chromium.Fun!
Correct F99 - keyCode is not an attribute
patrickhlauke commentedon May 1, 2025
filed #4374 which i think is all that's needed here
Correct F99 - keyCode is not an attribute (#4374)