🌐 AI搜索 & 代理 主页
Skip to content

Keyboard event.which incorrectly deprecated or documentation out of date? #4755

@cjhewett

Description

@cjhewett

Description

The TypeScript definitions here state event.which is:

@deprecatedDeprecated since 3.3. See \`{@link https://github.com/jquery/api.jquery.com/issues/821 }\`.

But on the deprecated 3.3 list there is no mention of deprecation:
https://api.jquery.com/category/deprecated/deprecated-3.3/

On the event.which page there is no mention of deprecation:
https://api.jquery.com/event.which/

On the keydown page there is no mention of deprecation and it even specifically advises to use event.which:
https://api.jquery.com/keydown/

To determine which key was pressed, examine the event object that is passed to the handler function. While browsers use differing properties to store this information, jQuery normalizes the .which property so you can reliably use it to retrieve the key code.


As an aside, surely while the native event.which may have been deprecated this is the JQuery event.which and this kind of cross browser normalisation is exactly why we use JQuery in the first place?

5 years after those issues were resolved and there is still no completely reliable native property to use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions