UNPKG

combokeys

Version:

Handles keyboard shortcuts in the browser

22 lines (18 loc) 574 B
/* eslint-env node, browser */ 'use strict' /** * should we stop this event before firing off callbacks * * @param {Event} e * @param {Element} element * @return {boolean} */ module.exports = function (e, element) { // if the element has the class "combokeys" then no need to stop if ((' ' + element.className + ' ').indexOf(' combokeys ') > -1) { return false } var tagName = element.tagName.toLowerCase() // stop for input, select, and textarea return tagName === 'input' || tagName === 'select' || tagName === 'textarea' || element.isContentEditable }