Re: [csswg-drafts] [cssom] Implement CSSStyleRule.p.matches (#3670)

> Should media queries be evaluated in the element's document? Or in the stylesheet's document? Or the current global's document? All three may be different and have different viewports, etc.

I think maybe the stylesheet's doc would be simplest to understand? Maybe a `TypeError` if the element belongs to a different document than the stylesheet.

> Should it account for the StyleSheet's `media` attribute? `disabled` too, maybe?

I hadn't thought of that. I would think yes, we should include them in the check.

> What about if it's an alternate sheet?

If the alternate were active, it should match normally. If not, everything should return false.

> Or an `@import`-ed sheet?

I'm not 100% clear how imported sheets are represented in the CSSOM. From your code sample, I'm assuming they just have `parentSyleSheet`s? If so, I think checking each `parentStyleSheet` to see if they also apply is the right choice.

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

Received on Sunday, 24 February 2019 22:39:08 UTC