UNPKG

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

17 lines (16 loc) 428 B
import inDOM from './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 */ export default function hidden(elm) { return !inDOM(elm) || (!elm.offsetHeight && !elm.offsetWidth) || getComputedStyle(elm).visibility === 'hidden'; }