Skip to content

Instantly share code, notes, and snippets.

@paulirish
paulirish / what-forces-layout.md
Last active July 21, 2025 17:36
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@cbourdage
cbourdage / rating-loop.less
Created July 1, 2015 22:48
ratings loop
.rating-box {
display: inline-block;
line-height: 1.8;
margin-right: 5px;
vertical-align: top;
.loop(@total, @i:1) when (@i =< (@total)) {
&.rating-@{i} {
.rating {
@kanduvisla
kanduvisla / jquery.increment.js
Created March 28, 2012 10:30
jQuery Input Field Incrementer
(function (jQuery) {
jQuery.fn.extend({
incrementButtons:function (options) {
var defaults = {
minVal:null,
maxVal:null,
incClass:'inc',
decClass:'dec',
@luetkemj
luetkemj / wp-query-ref.php
Last active April 6, 2025 09:15
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/