Skip to content

BladeRunnerJS/keyboard-event

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

keyboard-event

Why this library exists:

  • DOM Level 2 omitted keyboard events from the specification, so every browser did keyboard event creation differently.
  • The DOM Level 2/3 way of creating synthetic events (e.g. document.createEvent() followed by event.initKeyboardEvent()) is awkward since all arguments are mandatory, and since two method invocations are required instead of one.
  • DOM Level 4 deprecates the old way of creating events, preferring event constructors instead, and it just so happens that most modern browsers have implemented this in a consistent way.
  • That leaves the IE8 and IE9+ browsers as being the only ones yet to join the party!

The keyboard-event library polyfills the KeyboardEvent constructor for IE8 and IE9+, and, because some older versions of Chrome continue to use keyIdentifier instead of key, we polyfill that when needed. This polyfill differs from termi's polyfill in that it's much lighter, having only the IEs to worry about, and in that it adheres to the current standards.

About

KeyboardEvent constructor polyfill

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •