Skip to content

Instantly share code, notes, and snippets.

@zmofei
zmofei / answer
Created April 21, 2016 02:44
最前端:2016年4月20日,智力题题目解决方案
function add(a, b) {
var res = '',
c = 0
a = a.split('')
b = b.split('')
while (a.length || b.length || c) {
c += ~~a.pop() + ~~b.pop()
res = c % 10 + res
c = c > 9
}
@paulirish
paulirish / what-forces-layout.md
Last active June 26, 2024 20: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