Parcourir la source

Let the browser paint the page before highlighting code

Thibaut Courouble il y a 9 ans
Parent
commit
75b80a05fd
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      assets/javascripts/views/pages/base.coffee

+ 2 - 1
assets/javascripts/views/pages/base.coffee

@@ -13,7 +13,8 @@ class app.views.BasePage extends app.View
     @prepare?() unless fromCache
     @activate()
     @delay @afterRender if @afterRender
-    $.requestAnimationFrame(@paintCode) if @highlightNodes.length > 0
+    if @highlightNodes.length > 0
+      $.requestAnimationFrame => $.requestAnimationFrame(@paintCode)
     return
 
   highlightCode: (el, language) ->