Skip to content

Instantly share code, notes, and snippets.

@paulirish
paulirish / what-forces-layout.md
Last active June 9, 2024 13:52
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
@steida
steida / gist:8592161
Created January 24, 2014 04:37
Gulp.js, keep the original folder structure, for side by side compilation.
var coffee = require('gulp-coffee');
var eventStream = require('event-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var scriptsDirs = [
'bower_components/este-library/este/',
'client/',
'server/'
];
@bpedro
bpedro / mkdir_p.js
Last active October 31, 2020 00:35
nodejs implementation of recursive directory creation (https://brunopedro.com/2010/12/15/recursive-directory-nodejs/)
var fs = require('fs');
/**
* Offers functionality similar to mkdir -p
*
* Asynchronous operation. No arguments other than a possible exception
* are given to the completion callback.
*/
function mkdir_p(path, mode, callback, position) {
mode = mode || 0777;