scottjehl/Respond — pull request #109 by jameswestgate (2012-02-18 13:09:56+00:00)
Title: Integrate matchMedia to get support for AddListener and RemoveListener.

Take advantage of response.js window.resize loop to add support for a media query list using regex based engine.

Initially wanted to add listener support to Paul's matchMedia.js . Tried a non-timer approach with among other things onpropertychanged / DOMAttrChanged, as well as the css3 transition end approach but realised fully xbrowser was going to need a timer. Didn't want to add another window.resize handler/timer and realised response.js was already:

i) using matchMedia.js
ii) watching window.resize

So I:

i) Moved matchMedia into response.js core, adding the AddListener and RemoveListener methods.
ii) Added the matchMedia media queries to the Rule array so that the listeners were fired instead of the style changes being applied.
iii) Added a feature detect in case there was support for media queries, but not matchMedia (IE9)
iv) Tested in IE6-9, latest Firefox, Safari, Chrome.