/**
* @module getHiddenHeight
* @description Gets the height of hidden objects by temporarily revealing them and processing.
*
* @since 1.0.0
*
* @param {HTMLElement} el The hidden element to get height for.
*
* @return {number} The height in pixels as number for the hidden element.
*
* @example
* import { getHiddenHeight } from "@gravityforms/utils";
*
* function Example() {
* const node = document.getElementById( 'hidden-example' );
* const height = getHiddenHeight( node );
* }
*
*/
export default function getHiddenHeight( el ) {
const width = el.clientWidth;
const element = el;
element.style.visibility = 'hidden';
element.style.height = 'auto';
element.style.maxHeight = 'none';
element.style.position = 'fixed';
element.style.width = `${ width }px`;
const tHeight = element.offsetHeight;
element.style.visibility = '';
element.style.height = '';
element.style.maxHeight = '';
element.style.width = '';
element.style.position = '';
element.style.zIndex = '';
return tHeight;
}