if possible append the measure node to the body

to prevent flickering
This commit is contained in:
Fabian Jakobs 2011-02-26 20:44:48 +01:00
commit e18c9cad9f

View file

@ -113,11 +113,15 @@ var Text = function(parentEl) {
// Note: characterWidth can be a float!
measureNode.innerHTML = lang.stringRepeat("Xy", n);
var container = this.element.parentNode;
while (!dom.hasCssClass(container, "ace_editor"))
container = container.parentNode;
if (document.body) {
document.body.appendChild(measureNode);
} else {
var container = this.element.parentNode;
while (!dom.hasCssClass(container, "ace_editor"))
container = container.parentNode;
container.appendChild(measureNode);
}
container.appendChild(measureNode);
}
var style = this.$measureNode.style;