UNPKG

@qntm-code/utils

Version:

A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.

18 lines (17 loc) 620 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getElementHeight = void 0; const constants_1 = require("../constants"); const getComputedStyleAsNumber_1 = require("./getComputedStyleAsNumber"); /** * Get the height of an element. * * This helper allows getting of the height when running in a JSDOM environment. */ function getElementHeight(element) { if (constants_1.isJsdom) { return (0, getComputedStyleAsNumber_1.getComputedStyleAsNumber)(element, 'height'); } return element.getBoundingClientRect().height; } exports.getElementHeight = getElementHeight;