Skip to content

Instantly share code, notes, and snippets.

View bakura10's full-sized avatar

Michaël Gallego bakura10

View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active April 24, 2024 12:47
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
@sebastianseilund
sebastianseilund / merged_array.js
Last active December 20, 2015 07:58
An implementation of a merged array in Ember.js that combines items from multiple source arrays so you can easily list them together in your Handlebars templates. Read the blog post at the [Billy's Billing Developer Blog](http://dev.billysbilling.com/blog/How-to-merge-multiple-data-sources-into-one-array-in-Ember-js)
/**
* `Ember.MergedArray` is an array that observes multiple other arrays (called source arrays) for changes and includes
* all items from all source arrays in an efficient way.
*
* Usage:
*
* ```javascript
* var obj = Ember.Object.create({
* people: [
* {