Explorar o código

Let the browser paint the page before highlighting code

Thibaut Courouble %!s(int64=9) %!d(string=hai) anos
pai
achega
75b80a05fd
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  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) ->