keithamus/jwerty

jwerty.is() not working in FF

Open

#38 建立於 2013年7月10日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)JavaScript (1,214 star) (117 fork)batch import
help wanted

描述

// For each property in the jwertyCode object, compare to `event`
for (var p in jwertyCode[n]) {
    // ...except for jwertyCode.jwertyCombo...
    if (p !== 'jwertyCombo' && event[p] != jwertyCode[n][p]) returnValue = false;
}

I'm trying to check for key binding when clicking on an element but jwerty.is() does return false for 'shift', 'cmd' & 'alt'. After some minutes of debugging I've found the problem: You're getting the originalEvent which is in that case [object MouseEvent] and has no property keyCode for that reason. Therefore the result is always false. I'm not sure if there is a solution for this problem in FF, but it is working fine in Chrome. Thanks for this wonderful library!

貢獻者指南

jwerty.is() not working in FF · keithamus/jwerty#38 | Good First Issue