Re: [csswg-drafts] proposal: [CSS-import] import only in moment when we need it.

@Loirooriol That doesn't answer the OP's question; it says browsers *may* avoid fetching such a stylesheet. In practice, tho, browsers have to fetch them, because web-compat depends on stylesheets quickly exposing a CSSStyleSheet when MQs change (rather than a `null` that's later swapped out for a `CSSStyleSheet`).

On the other hand, a `supports()` function after the `@import` *does* require that the stylesheet not be fetched if it doesn't match, because support conditions dont' change over a page's lifetime; they'll either be always false or always true.

So we don't currently have a way to define that a stylesheet *shouldn't* be fetched if a MQ doesn't match. That's something we should probably support somehow, tho. (And carry over to `<link rel=stylesheet>`.)

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3050#issuecomment-415845827 using your GitHub account

Received on Friday, 24 August 2018 18:36:10 UTC