mq-polyfill icon indicating copy to clipboard operation
mq-polyfill copied to clipboard

Polyfilled matchMedia never matches float "max-width" queries

Open TxHawks opened this issue 7 years ago • 2 comments

Whenever passing a float as the value of a max-width query, matches returns false even when the test should pass. Tested this with both px and em based queries.

Expected behavior:

// After polyfilling matchMedia
window.innerWidth = 700;
window.outerWidth = 700;

window.matchMedia('(max-width: 2.5em)').matches; // => true

Actual behavior:

// After polyfilling matchMedia
window.innerWidth = 700;
window.outerWidth = 700;

window.matchMedia('(max-width: 2.5em)').matches; // => false
window.matchMedia('(max-width: 3em)').matches; // => true

TxHawks avatar Dec 05 '17 13:12 TxHawks

To add to the above, float min-width queries always match

TxHawks avatar Dec 05 '17 16:12 TxHawks

Was there any movement on this?

sunsheeppoplar avatar Nov 13 '18 18:11 sunsheeppoplar