Every once in a while, Chrome will render perfectly valid HTML/CSS incorrectly or not at all. Digging in through the DOM inspector is often enough to get it to realize the
If you want to preserve the styles declared into your stylesheets, better to use something like:
jQuery.fn.redraw = function() {
this.css('display', 'none');
var temp = this[0].offsetHeight;
this.css('display', '');
temp = this[0].offsetHeight;
};
$('.layer-to-repaint').redraw();
NB: with latest webkit/blink, storing the value of offsetHeight
is mandatory in order to trigger the repaint, otherwise the VM (for optimizations purposes) will probably skip that instruction.
Update: added the second offsetHeight
reading, it is necessary to prevent browser from queueing/caching a following CSS property/class change with the restore of the display
value (this way a CSS transition that can follow should be rendered)