ResizeObserver Polyfill

A spec-compliant polyfill for the ResizeObserver API using MutationObserver

Library
npm
v1.5.1
1,750 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
41 /100 Fair
Development Activity 0
Maintenance 20
Community 44
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
71 /100 Good
Architecture 72
Code Quality 74
Innovation 55
Learning Curve 82

resize-observer-polyfill is a lightweight implementation of the ResizeObserver API for browsers that predate native support. It’s built on MutationObserver, falling back to Mutation Events only where necessary, so it avoids polling and only recalculates layout in response to actual DOM changes; it also correctly picks up size changes from CSS transitions, animations, and dynamic pseudo-classes like :hover.

Designed to be used as a ponyfill (imported directly rather than patching the global window object), it became one of the standard dependencies for UI libraries and component frameworks that needed reliable element-resize detection before ResizeObserver reached universal browser support, and remains heavily downloaded as a safety-net dependency in libraries supporting older environments.

What You Get

  • A drop-in ResizeObserver class matching the native API’s observe()/unobserve()/disconnect() methods
  • MutationObserver-based change detection with a Mutation Events fallback for older browsers
  • No polling — layout recalculation only happens in response to actual DOM/style changes
  • Detection of size changes from CSS transitions, animations, and dynamic pseudo-classes like :hover
  • TypeScript and Flow type definitions bundled in the package

Common Use Cases

  • Adding reliable element-resize detection to component libraries that must support older browsers
  • Powering responsive, container-query-style layouts before native ResizeObserver/CSS container queries were available
  • Triggering re-renders in charting or canvas libraries when their container element changes size
  • Detecting size changes caused by dynamic content, CSS animations, or hover-triggered layout shifts

Under The Hood

Architecture ResizeObserver.js exposes the public class that delegates all real work to a shared ResizeObserverController singleton, which maintains the list of active observations (ResizeObservation.js) and schedules a batched callback dispatch; the actual change-detection mechanism is abstracted behind an SPI (ResizeObserverSPI.js) so the MutationObserver-based strategy (with a Mutation Events fallback under src/shims) can be swapped without touching the public API. Tech Stack Plain JavaScript (no runtime dependencies), built with Rollup into both CommonJS (dist/ResizeObserver.js) and ES module (dist/ResizeObserver.es.js) bundles, with hand-written .d.ts and Flow type definitions shipped alongside; testing uses Karma against real browsers (including Sauce Labs cross-browser runs) plus a Node-based spec runner. Code Quality The tests/ directory includes both browser-run Karma specs and a dedicated Node test entry point (tests/node/index.js), with ESLint enforced via npm run test:lint before any spec run — a solid but browser-API-focused test setup appropriate for a small polyfill; the project has seen no material commits since its 2018 1.5.1 release, reflecting that native ResizeObserver support has since made it feature-complete rather than abandoned. API Design The library deliberately mirrors the native ResizeObserver constructor/callback signature exactly, so adopting it requires zero API-learning curve beyond importing it as a named ponyfill rather than relying on a global — the tradeoff being that, being frozen since 2018, it won’t track any spec changes made to the native API after that point.

Used by 13 apps in this directory

TypeScript
72%
AGPL 3.0

APITable

Databases · Low Code Platforms

15,623

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
71
Repo Health
77
Technical
60
Dependency
Built with
TypeScript 72%
Java 22%
Updated 1 months ago
TypeScript
68%
Apache 2.0

Appsmith

Automation · Developer Tools · No Code Platforms

40,959

Open-source low-code platform to build admin panels, dashboards, and internal tools connected to any database or API.

View details
93
Repo Health
79
Technical
66
Dependency
Built with
TypeScript 68%
Java 21%
Updated 1 weeks ago
Go
92%
AGPL 3.0

BillionMail

Marketing

15,695

Self-hosted email server and marketing platform that gives you unlimited sending, full deliverability control, and AI-assisted campaigns without monthly fees.

View details
52
Repo Health
74
Technical
70
Dependency
Built with
Go 92%
Updated 4 months ago
TypeScript
70%
Other

Budibase

Low Code Platforms · No Code Platforms

28,324

Build AI agents, automations, and internal apps on a single open-source platform with full self-hosting control.

View details
91
Repo Health
81
Technical
63
Dependency
Built with
TypeScript 70%
Svelte 26%
Updated 2 weeks ago
TypeScript
96%
Other

Cal.diy

Scheduling

48,697

The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.

View details
91
Repo Health
86
Technical
65
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
Go
75%
AGPL 3.0

Coder

Code Editors · Developer Tools · Devops

16,729

Self-hosted cloud development environments and AI coding agents — defined in Terraform, connected via WireGuard, automatically shut down when idle.

View details
91
Repo Health
90
Technical
65
Dependency
Built with
Go 75%
TypeScript 23%
Updated 1 weeks ago
JavaScript
90%
Other

CodeSandbox

Code Editors · Developer Tools

13,650

Instantly ready browser-based IDE that runs full npm dependency resolution and transpilation entirely client-side, with no server needed.

View details
67
Repo Health
76
Technical
62
Dependency
Built with
JavaScript 90%
Updated 1 months ago
Java
34%
Apache 2.0

Enso

Analytics · Data Engineering · Low Code Platforms

7,441

A visual and textual programming platform for data prep and analysis where the node graph and the underlying Enso code are always perfectly in sync, built by an Alteryx co-founder on a GraalVM engine.

View details
59
Repo Health
90
Technical
61
Dependency
Built with
Java 34%
TypeScript 27%
Scala 26%
Updated 2 months ago
TypeScript
98%
Other

Formbricks

Analytics · Design Tools · Forms Surveys

13,031

Open-source experience management platform for in-app, website, email, and link surveys — privacy-first and fully self-hostable.

View details
93
Repo Health
81
Technical
67
Dependency
Built with
TypeScript 98%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers