<!DOCTYPE html>
<div style="display: none"><span>x</span></div>
<script>
document.body.offsetWidth;
document.querySelector("div").style.display = "inline";
document.body.offsetWidth;
document.querySelector("span").style.color = "blue";
document.body.offsetWidth;
</script>