Skip to content

Instantly share code, notes, and snippets.

View kehao-chen's full-sized avatar
🥷
I don't write code. I weave digital jutsu.

Kehao Chen kehao-chen

🥷
I don't write code. I weave digital jutsu.
View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active February 26, 2026 06:28
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
@tracker1
tracker1 / 01-directory-structure.md
Last active January 13, 2026 20:36
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used