Thomas Fuchs
Hi, I'm Thomas Fuchs. I'm the author of Zepto.js, of script.aculo.us, and I'm a Ruby on Rails core alumnus. With Amy Hoy I'm building cheerful software, like Noko Time Tracking and Every Time Zone and write books like Retinafy.me.
   Want me to speak at your conference? Contact me!

Force-redraw DOM technique for WebKit-based browsers

September 25th, 2009

Something I’ve tried when I had an issue with Safari 4 not properly layouting/rendering an element after setting a new value for its innerHTML:

element.style.webkitTransform = 'scale(1)';

This did the trick and should work with Safari, Chrome and other browsers that are based on WebKit.

If you need a more general solution for elements that don’t seem to render properly, try my text-node based trick.

Seems that browsers are a little bit too optimized, but as long as you can give them a nudge…