vanillajs-browser-helpers
Version:
Collection of convenience code snippets (helpers) that aims to make it a little easier to work with vanilla JS in the browser
23 lines (22 loc) • 714 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var inDOM_1 = __importDefault(require("./inDOM"));
/**
* Test if a given DOM element is technically hidden
* - Not is DOM
* - Collapsed
* - display: none
* - visibility: hidden.
*
* @param elm - DOM element to test
* @return Is the element technically hidden or not
*/
function hidden(elm) {
return !(0, inDOM_1.default)(elm)
|| (!elm.offsetHeight && !elm.offsetWidth)
|| getComputedStyle(elm).visibility === 'hidden';
}
exports.default = hidden;