I would like to emit a CtrlS keydown event using JavaScript. Ideally the solution works in most modern browsers (up to IE 9).
I am writing tests and need to test my handler for key bindings. CtrlS is just an example, it can be any key binding with a modifier key. I know about the keyEvent.initKeyboardEvent()
method but I was not able to use it correctly to trigger the same event I got when printing out the full keyboard event after pressing the key from the keyboard.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…