Re: [csswg-drafts] [css-conditional] Make CSSSupportsRule expose whether its condition is met (#4240)

I'd say `.matches` should always work in the context the related at-rule is in. I.e. if a media rule is disconnected from a document, conditions _requiring_ a document to properly evaluate like `(width > 1000px)` would always return `false`. (Or it might even return `undefined` as that is what it is, but then it wouldn't have a clearly boolean return value.) Though preference-based conditions like `(prefers-reduced-motion)` would still evaluate normally.

If it's attached to a document, it is always evaluated against that document, even when accessed from another document. In other words, it should behave the same as its `@media` counterpart.

Though I wonder what the use cases are for checking whether a media rule matches when it or the stylesheet it is in is disconnected.
`CSSSupportsRule.matches` has a much clearer use case in that case.

Sebastian

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


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

Received on Tuesday, 2 August 2022 20:33:16 UTC