Why is this javascript function so slow on Firefox?
- by macrael
This function was adapted from the website: http://eriwen.com/javascript/measure-ems-for-layout/
function getEmSize(el) {
var tempDiv = document.createElement("div");
tempDiv.style.height = "1em";
el.appendChild(tempDiv);
var emSize = tempDiv.offsetHeight;
el.removeChild(tempDiv);
return emSize;
}
I am running this…