I'm trying to get the height of an element after inserting its textContent. The element's height changes as the text is more than 2 lines. The issue is on first click the height I'm getting is wrong, the preceding click is the right height.
// onclick
element.textContent = text
var byOffset = element.offsetHeight;
var byBound = element.getBoundingClientRect();
console.log('by offset height', byOffset);
console.log('by bound height', byBound.height);
on first click
console: by offset height 37
console: by bound height 37
on preceding clicks (preferred output)
console: by offset height 79
console: by bound height 79