Skip to content

Instantly share code, notes, and snippets.

View mrinterweb's full-sized avatar

Sean McCleary mrinterweb

View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active November 15, 2024 16:45
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
@carlwoodward
carlwoodward / ember_websocket_adapter.js
Created January 27, 2014 23:49
A simple websocket adapter for ember-js.
Web.Store = DS.Store.extend();
DS.WebsocketAdapter = DS.RESTAdapter.extend({
callbacks: {},
socket: null,
beforeOpenQueue: [],
ajax: function(url, type, params) {
var adapter = this;
var uuid = adapter.generateUuid();
@rosstimson
rosstimson / controller.coffee
Created June 4, 2011 21:00
SproutCore 2.0 ToDo App in CoffeeScript
# SproutCore 2.0 ToDo App in CoffeeScript
# BSD3, Jinjing Wang 2011
#
# Ross Timson: Added in a few CoffeeScript syntactic niceties
Todos = SC.Application.create()
Todos.Todo = SC.Object.extend
title: null
isDone: false