Last Updated: February 25, 2016
·
1.001K
· iam4x

Ask webkit iOS a repaint

On iOS6 I had a problem with elements not rendered after changing page in my JS SinglePageApp.

To resolve that, I needed to ask webkit to repaint the view. Two solutions :

forceRedraw: (el) ->
    element = $(el)
    newEl = document.createTextNode(' ')
    element.append(newEl)
    newEl.parentNode.removeChild newEl
    element

And the magic one \o/ :

el.style.webkitTransform = el.style.webkitTransform