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: Boris Zbarsky via GitHub <sysbot+gh@w3.org>
Date: Wed, 07 Feb 2018 20:08:28 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-363894505-1518034107-sysbot+gh@w3.org>
> 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...  So while it would be nice, it's not obvious how web-compatible it is.  :(

> and the default style on these elements

Of course the "default" (UA + user) style can be different in different documents.  For example, nothing prevents media queries in UA/user sheets.  I know for a fact people _use_ them in user sheets.

> How does where you document comes from matter

Because it may not have an attached browsing context or other machinery that might be needed to compute styles.  What is the viewport size of an XHR responseXML document and why, for example?

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".

> There is indeed also the question of what to do with nodes that do not have used styles.

Things that are not in the flat tree don't even have a concept of computed styles, because inheritance is undefined for them.

And it's not clear that they have a clearly defined concept of specified styles either.

> 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).

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

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