Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Expose KeyboardEvent.code on jQuery event #3978
Keyboard events introduce new properties,
If you register a keydown event listener using W3 addEventListener and then
jQuery: keydown undefined ArrowRight 39 W3: keydown ArrowRight ArrowRight 39
Link to test case
While you're in there, IE implemented an older spec so they use 'Left', 'Right', 'Up' and 'Down' versus 'ArrowLeft', 'ArrowRight', 'ArrowUp' and 'ArrowDown' -- there may be other differences... If you still consider yourself an abstraction library I would LOVE if you could help pull IE up the hill.
Agreed and I am thinking this is a typo because we have
The problem with trying to normalize the names in IE11 is that it is especially bloating to put a comprehensive mapping like that in jQuery. If every person who ever used jQuery needed it that might make sense, but very few people need more than one or two keys.
I should also mention that you can get this property in
I appreciate the feedback. I understand the bloat argument and I can use regex to make the ‘Arrow’ bit optional or use multiple case statements to satisfy both implementations, but it's slightly odd for an abstraction library to not abstract away such differences. Hopefully M$ will prioritize standards compliance -- but I’ve lost that bet before... Step 1 is just getting .code back into the event object. Cheers…
On Feb 14, 2018, at 5:13 AM, Dave Methvin ***@***.***> wrote: Agreed and I am thinking this is a typo because [we have char and key[(https://github.com/jquery/jquery/blob/4a2bcc27f9c3ee24b3effac0fbe1285d1ee23cc5/src/event.js#L618-L620) but not code. I don't even see a char listed anywhere in the specs? @jbedard <https://github.com/jbedard> do you know? It's been around since jQuery 1.7 so it's not recent. I know the specs have changed several times over the years (which, keyCode/charCode, key/char). The problem with trying to normalize the names in IE11 is that it is especially bloating to put a comprehensive mapping like that in jQuery. If every person who ever used jQuery needed it that might make sense, but very few people need more than one or two keys. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#3978 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AMD_nt019MkcZ8oUSVFZR88xpK6T92vdks5tUtvcgaJpZM4SFBx7>.