Re: [csswg-drafts] [css-cascade-5] Do conditional rules impact layer order? (#6407)

I don't think we really can disallow layers inside media (parse error), or even apply the styles without contributing to layer-order. Sites sometimes use an html media attribute on most or all linked stylesheets (eg `media="screen"` or light/dark mode, etc). We'd be making it nearly impossible to use layers while also using that media attribute. I would find it very confusing if adding `media="screen"` to a stylesheet totally changed how all my layers work. 

@tabatkins also pointed out that once we allow layers inside conditional styles, we can't entirely avoid the dynamic behavior. Browsers often lazy-load stylesheets with an unmatched media attribute. If the media eventually matches, and those styles load late, either approach (always apply, or dynamically apply-on-match) will need to apply those changes once the sheet has loaded. That may be an argument for embracing the dynamic behavior, and making it the spec default.

If we do go that rout, though, we would need a special case for container queries, which do not have any global "matched" state.

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 25 June 2021 20:46:58 UTC