按下tab, shift, up/down/left/right arrow
键时,Firefox会触发keypress
回调函数,但Chrome,Safari,IE不会。按键[tab,shift,向上/向下/向左/向右箭头]和firefox
请参考this CodePen。
它不仅触发上keypress
回拨功能,而且还通过了keyCode
为0
当按下按键tab, shift, up/down/left/right arrow
。
我可以
var charCode = (typeof e.which === 'number') ? e.which : e.keyCode;
if (charCode === 0) return;
但想知道,如果它在Firefox中的错误,而为什么会出现Firefox和其他浏览器之间的不一致?
看起来像它在Firefox中的一个错误 – sarbbottam