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

> 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