Ver código fonte

Let the browser paint the page before highlighting code

Thibaut Courouble 9 anos atrás
pai
commit
75b80a05fd
1 arquivos alterados com 2 adições e 1 exclusões
  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) ->