ResizeObserver Polyfill

A spec-compliant polyfill for the ResizeObserver API using MutationObserver

Library
npm
v1.5.1
1,752stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
41/100Fair
Development Activity0
Maintenance20
Community44
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
71/100Good
Architecture72
Code Quality74
Innovation55
Learning Curve82

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

Low Code Platforms · Databases

15,526

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

View details
53
Repo Health
77
Technical
60
Dependency
Built with
TypeScript72%
Java22%
Updated 9 months ago
TypeScript
66%
Apache 2.0

Appsmith

Developer Tools · Automation · No Code Platforms

40,707

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

View details
94
Repo Health
79
Technical
68
Dependency
Built with
TypeScript66%
Java22%
Updated today
Go
92%
AGPL 3.0

BillionMail

Marketing

15,424

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

View details
59
Repo Health
74
Technical
73
Dependency
Built with
Go92%
Updated 2 months ago
TypeScript
69%
Other

Budibase

Low Code Platforms · No Code Platforms

28,220

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

View details
92
Repo Health
81
Technical
63
Dependency
Built with
TypeScript69%
Svelte26%
Updated today
TypeScript
96%
Other

Cal.diy

Scheduling

47,796

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

View details
93
Repo Health
86
Technical
66
Dependency
Built with
TypeScript96%
Updated 1 weeks ago
Go
76%
AGPL 3.0

Coder

Devops · Developer Tools · Code Editors

14,199

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

View details
93
Repo Health
90
Technical
71
Dependency
Built with
Go76%
TypeScript22%
Updated today
JavaScript
90%
Other

CodeSandbox

Code Editors · Developer Tools

13,633

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

View details
65
Repo Health
76
Technical
63
Dependency
Built with
JavaScript90%
Updated 1 months ago
Java
34%
Apache 2.0

Enso

Analytics · Data Engineering · Low Code Platforms

7,437

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
70
Repo Health
90
Technical
62
Dependency
Built with
Java34%
TypeScript27%
Scala26%
Updated 1 weeks ago
TypeScript
98%
Other

Formbricks

Forms Surveys · Marketing · Analytics

12,790

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
73
Dependency
Built with
TypeScript98%
Updated today

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

Search