Skip to content

Instantly share code, notes, and snippets.

@huihao
huihao / what-forces-layout.md
Created December 8, 2016 05:27 — forked from paulirish/what-forces-layout.md
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.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
var find = (function() {
var find = function(data) {
this.data = data || {};
this.pager = false;
};
find.prototype = {
load: function(callback) {
var data = this.data;
load(data.params, data, function(result) {
@huihao
huihao / gulpfile.js
Created October 13, 2015 14:47 — forked from darkwing/gulpfile.js
"punky" theme build file for David Walsh Blog
'use strict';
/*
Ways to improve site speed for theme:
===========================================
- Store fonts.css in localStorage, don't make request if it's there
- Create a custom FontAwesome lib, lazyload
*/