examples/webpack/src/utils/measureTextWidth.js
function createMeasurementElement() {
	const hiddenElement = document.createElement( "div" );

	hiddenElement.id = elementId;

	// Styles to prevent unintended scrolling in Gutenberg.
	hiddenElement.style.position = "absolute";
	hiddenElement.style.left = "-9999em";
	hiddenElement.style.top = 0;
	hiddenElement.style.height = 0;
	hiddenElement.style.overflow = "hidden";
	hiddenElement.style.fontFamily = "arial, sans-serif";
	hiddenElement.style.fontSize = "18px";
	hiddenElement.style.fontWeight = "400";

	document.body.appendChild( hiddenElement );
	return hiddenElement;
}
function createMeasurementElement() {
	const hiddenElement = document.createElement( "div" );

	hiddenElement.id = elementId;

	// Styles to prevent unintended scrolling in Gutenberg.
	hiddenElement.style.position = "absolute";
	hiddenElement.style.left = "-9999em";
	hiddenElement.style.top = 0;
	hiddenElement.style.height = 0;
	hiddenElement.style.overflow = "hidden";
	hiddenElement.style.fontFamily = "arial, sans-serif";
	hiddenElement.style.fontSize = "18px";
	hiddenElement.style.fontWeight = "400";

	document.body.appendChild( hiddenElement );
	return hiddenElement;
}
function createMeasurementElement ( ) { const hiddenElement = document . createElement ( "div" ) ; hiddenElement . id = elementId ; // Styles to prevent unintended scrolling in Gutenberg. hiddenElement . style . position = "absolute" ; hiddenElement . style . left = "-9999em" ; hiddenElement . style . top = 0 ; hiddenElement . style . height = 0 ; hiddenElement . style . overflow = "hidden" ; hiddenElement . style . fontFamily = "arial, sans-serif" ; hiddenElement . style . fontSize = "18px" ; hiddenElement . style . fontWeight = "400" ; document . body . appendChild ( hiddenElement ) ; return hiddenElement ; }
Creates an hidden element with the purpose to calculate the sizes of elements and adds these elements to the body.

@returns {HTMLElement} The created hidden element.
Creates an hidden element with the purpose to calculate the sizes of elements and adds these elements to the body .