W3C home > Mailing lists > Public > public-css-archive@w3.org > February 2019

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

From: Justin Ridgewell via GitHub <sysbot+gh@w3.org>
Date: Sun, 24 Feb 2019 22:39:06 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-466825085-1551047945-sysbot+gh@w3.org>
> 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

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:44 UTC