Martin Winkler published a package that polyfills Element.matchContainer() to notify scripts when a Container Query matches or unmatches, using StyleObserver under the hood. The polyfill allows attaching events to container queries similar to how Window.matchMedia() handles media queries. Demos showcase its use for size and style queries. The package injects necessary CSSOM rules to observe changes and leverages custom properties for functionality.

Table of contents
Window.matchMedia()Element.matchContainer()DemosStyleObserver under the hoodIn ClosingSort: