[csswg-drafts] [css-media-queries] css media query width and window.innerWidth may not be equal (#4713)

mjf-g has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-media-queries] css media query width and window.innerWidth may not be equal ==
According to the CSS specifications, both of them are the width of the viewport: [1], [2]. So they should be equal. But the window.innerWidth is a signed integer while media queries can specify float precision: [1], [3].

So they may not be equal, for example:
Web page zoom level: 300%;
Physical pixel width: 1000px;
"window.matchMedia('(width: ' + window.innerWidth + 'px)').matches" will be set to false.


References:
1. https://www.w3.org/TR/css3-mediaqueries/#width
2. https://drafts.csswg.org/cssom-view/#dom-window-innerwidth
3. https://drafts.csswg.org/cssom-view/#ref-for-dom-window-innerwidth


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4713 using your GitHub account

Received on Wednesday, 29 January 2020 13:17:18 UTC