Skip to content

Instantly share code, notes, and snippets.

@korya
Created April 11, 2016 20:59
Show Gist options
  • Save korya/d869b76f8fb950878c8f78f29df94402 to your computer and use it in GitHub Desktop.
Save korya/d869b76f8fb950878c8f78f29df94402 to your computer and use it in GitHub Desktop.
Browser rendering: reflows, repaints...

Functions flushing browser's "reflow" queue:

  • offsetTop, offsetLeft, offsetWidth, offsetHeight
  • scrollTop/Left/Width/Height
  • clientTop/Left/Width/Height
  • getComputedStyle(), or currentStyle in IE

All of these above are essentially requesting style information about a node, and any time you do it, the browser has to give you the most up-to-date value. In order to do so, it needs to apply all scheduled changes, flush the queue, bite the bullet and do the reflow.

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment