Skip to content

Instantly share code, notes, and snippets.

View kiloc's full-sized avatar

Chen kiloc

View GitHub Profile
@kiloc
kiloc / what-forces-layout.md
Created August 22, 2024 09:21 — 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.

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
@kiloc
kiloc / README.md
Created June 23, 2022 12:24 — forked from straker/README.md
Basic Missile Command HTML and JavaScript Game

Basic Missile Command HTML and JavaScript Game

This is a basic implementation of the Atari Missile Command game, but it's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration

  • Score
  • When a missile explodes (not a counter-missile), the score should increase by 25