// the find
paulirish/matchMedia.js
matchMedia polyfill for testing media queries in JS
A polyfill for window.matchMedia, written in 2011-2012 to give IE8/9 and old Safari access to CSS media query evaluation from JavaScript. The target problem — browsers that don't support matchMedia — is effectively extinct in 2024.
Tiny and focused — two files, no dependencies. The addListener shim correctly uses resize/orientationchange events to approximate the native MediaQueryList listener API. Written by credible authors (Paul Irish, Scott Jehl) so it was reliable for its era. Still technically correct for the narrow case of needing matchMedia in a legacy environment.
Last touched in 2020, and the meaningful work stopped years before that — this is a maintenance-mode archive, not an active project. The polyfill targets IE6-9 and old mobile browsers with a combined market share that is effectively zero in any modern project. The addListener approach is a polling hack via resize events with no debouncing, which would hammer the main thread. Using bower.json as the primary package descriptor dates this pretty precisely.