-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Description
Description
The TypeScript definitions here state event.which is:
@deprecated Deprecated 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.