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

Re: [csswg-drafts] [cssom] [css-display] [css-values] Clarify behavior of window.getComputedStyle on detached subtrees, and the definition of "the root element".

From: François REMY via GitHub <sysbot+gh@w3.org>
Date: Wed, 07 Feb 2018 20:46:50 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-363905063-1518036409-sysbot+gh@w3.org>
> An element assigned to a slot doesn't inherit from the shadow host, but from the assigned slot. There's no spec that defines that in case it's not assigned to any slot it should inherit from the host, afaict.

Ah, that should probably be added then; more than likely it's just an oversight. Using their parent's style is the closest approximation of the behavior that would happen whenever it gets slotted, so that looks reasonable to me.


> > I have the feeling that an API like getComputedStyle should always return the same result independently of the realm you are calling from.
> Not that this is neither what the current spec says nor what browsers currently do, last I checked

I'm fairly sure Edge is doing that, or is at least pretty close from that.


> The rest of what you say about XML is not relevant to my question: my question is specifically about documents that are not "in a browsing context".

The testcase I provided shows that, at least in Edge, that does not matter. 

I agree that we should probably define what to do with media queries in that case. In Edge, we seem to evaluate everything as if the viewport was 0px by 0px. 

https://wptest.center/#/zq8ym1 *(Computed styles in xml markup, with media queries)*


> > Everybody seems to be interoperable regarding nodes in display:none subtrees
> "seems" is key. For example, Gecko and WebKit/Blink don't agree on http://jsbin.com/xiluvogequ/edit?html,output (I haven't tested Edge so far).

http://jsbin.com/sitivicafo/1/edit?html,output (updated to work in Edge as we don't support srcdoc). We match Chrome and return the style you would get from applying the styles of the iframe.

I will admit I'm really perplexed with Firefox's behavior here. Applying the stylesheets of one document on another document doesn't seem relevant, and seems more like a bug than a feature.

GitHub Notification of comment by FremyCompany
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1548#issuecomment-363905063 using your GitHub account
Received on Wednesday, 7 February 2018 20:47:38 UTC

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