Does this happen every frame? That's going to be slooow (lots of DOM invalidations).