license import { cssClasses } from './constants' ; /**
 * Stores result from computeHorizontalScrollbarHeight to avoid redundant processing.
 */ let horizontalScrollbarHeight_ ; /**
 * Computes the height of browser-rendered horizontal scrollbars using a self-created test element.
 * May return 0 (e.g. on OS X browsers under default configuration).
 */ export function computeHorizontalScrollbarHeight ( documentObj , shouldCacheResult = true ) { if ( shouldCacheResult && typeof horizontalScrollbarHeight_ !== 'undefined' ) { return horizontalScrollbarHeight_ ; } const el = documentObj . createElement ( 'div' ) ; el . classList . add ( cssClasses . SCROLL_TEST ) ; documentObj . body . appendChild ( el ) ; const horizontalScrollbarHeight = el . offsetHeight - el . clientHeight ; documentObj . body . removeChild ( el ) ; if ( shouldCacheResult ) { horizontalScrollbarHeight_ = horizontalScrollbarHeight ; } return horizontalScrollbarHeight ; }