UNPKG

@vuesax-alpha/nightly

Version:
25 lines (22 loc) 763 B
import { round } from '../../utils/index.mjs'; import { isHTMLElement } from '../../utils/dom.mjs'; function getCssDimensions(element) { const css = getComputedStyle(element); let width = Number.parseFloat(css.width) || 0; let height = Number.parseFloat(css.height) || 0; const hasOffset = isHTMLElement(element); const offsetWidth = hasOffset ? element.offsetWidth : width; const offsetHeight = hasOffset ? element.offsetHeight : height; const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; if (shouldFallback) { width = offsetWidth; height = offsetHeight; } return { width, height, $: shouldFallback }; } export { getCssDimensions }; //# sourceMappingURL=get-css-demenssions.mjs.map