Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@paulirish
paulirish / what-forces-layout.md
Last active April 23, 2024 11:02
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
@andrewhathaway
andrewhathaway / Gulpfile.js
Last active August 10, 2017 02:00
Environment-based configuration for JavaScript applications - Gulpfile.js
var Gulp = require('gulp');
var Del = require('del');
var Rename = require('gulp-rename');
var RunSequence = require('run-sequence');
var Yargs = require('yargs');
var argv = Yargs.argv;
/**
* Build Settings
@alotaiba
alotaiba / google_text2speech.md
Created February 3, 2012 07:31
Google Text to Speech API

Google Text to Speech API

Base URL: http://translate.google.com/translate_tts
It converts written words into audio. It accepts GET requests.

GET

q
The query string to convert to audio

tl
Translation language, for example, ar for Arabic, or en-us for English

@lbj96347
lbj96347 / vim config
Last active April 25, 2016 06:14
vim config
syntax on " 语法高亮
filetype plugin indent on " 文件类型检测
autocmd BufEnter * :syntax sync fromstart
let mapleader=","
set nocompatible " 关闭兼容模式
set autoindent " 打开自动缩,继承前一行的缩进方式,特别适用于多行注释
set nu " 显示行号
set showcmd " 显示命令
set noswapfile " 不使用swp文件
set nobackup " 关闭备份