UNPKG

alm

Version:

The best IDE for TypeScript

28 lines (27 loc) 965 B
"use strict"; /** * Returns true if the element is some form of input. * There are certain browser actions you don't want to happen if the element is not an input */ Object.defineProperty(exports, "__esModule", { value: true }); function someFormOfInput(element) { if (!element.tagName) { return false; } var tagName = element.tagName.toUpperCase(); if ((tagName === 'INPUT' && (element.type.toUpperCase() === 'TEXT' || element.type.toUpperCase() === 'PASSWORD' || element.type.toUpperCase() === 'FILE' || element.type.toUpperCase() === 'SEARCH' || element.type.toUpperCase() === 'EMAIL' || element.type.toUpperCase() === 'NUMBER' || element.type.toUpperCase() === 'DATE')) || (tagName === 'TEXTAREA')) { return !element.readOnly && !element.disabled; } else { return false; } } exports.someFormOfInput = someFormOfInput;