I don't think it needs to happen in JS first. A CSS media query is completely opt-in. Developers don't need to use the media query if they do not want to, it is just a way that developers can make their websites more friendly to users with bandwidth constraints without sacrificing for users who do not have bandwidth constraints.

On 12/09/2016 11:51 AM, Jonathan Garbee wrote:
FTR there was a working group to provide a Network Information API [1] to
let JS handle this more easily. In trying to do that, they had a difficult
time actually getting accurate information for the API to provide. So it
was canned in order to further assess the cases specifically and other
approaches. I highly doubt if there was trouble building a JS API for this
type of thing that CSS alone can handle it in some way.

If something like this is to happen, it *needs* to happen in JS first. That
way developers have control, from a working and proven implementation there
we could find a syntax for CSS to work on top of. So for now, you're
probably best off polyfilling some JS API and using that to experiment with
to present as a solution. That way it can be more easily vetted and tested.

[1] https://dvcs.w3.org/hg/dap/raw-file/tip/network-api/Overview.html

On Fri, Dec 9, 2016 at 12:43 PM Michael A. Peters <mpet...@domblogger.net>
wrote:

On 12/09/2016 09:03 AM, Boris Zbarsky wrote:
On 12/9/16 5:57 AM, Michael A. Peters wrote:
max-height and max-width and orientation change, but device-width does
not change.

Just as a point of fact, device-width can absolutely change.  The
simplest case is a two-monitor setup with the window getting dragged
from one monitor to another, but similar things can happen when things
are docked/undocked, monitors are plugged in or removed, etc.

-Boris

Ah yes, point taken.

With a bandwidth query I would recommend it only change on a page reload
but it wouldn't have to be done that way.

This wouldn't only be beneficial to fonts, a lot of images etc. are
defined in CSS too.


Reply via email to