Skip to content

Conversation

@emilio
Copy link
Collaborator

@emilio emilio commented Apr 13, 2018

See individual commits for reference.

@emilio emilio requested review from annevk and tabatkins April 13, 2018 20:37
@gsnedders gsnedders added the cssom-1 Current Work label Apr 14, 2018
and its <a>shadow-including root</a>'s <a>browsing context</a> either doesn't have a
<a>browsing context container</a>, or that <a>browsing context container</a>
is <a>being rendered</a>,
let <var>decls</var> be a list of all longhand properties that are
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want to use set here, since you're overwriting something. See https://infra.spec.whatwg.org/. (Older specifications are inconsistent with this unfortunately.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, thanks for the tip, will change :)

<li>If <var>elt</var> is <a>connected</a>, part of the <a>flat tree</a>,
and its <a>shadow-including root</a>'s <a>browsing context</a> either doesn't have a
<a>browsing context container</a>, or that <a>browsing context container</a>
is <a>being rendered</a>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would it (not) be rendered?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it's a display: none iframe, for example (IIUC), or one of the ancestors in the chain is not rendered itself, which is one of the cases we wan to return no styles in.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, that makes sense.


<li>Let <var>decls</var> be an empty list of <a>CSS declarations</a>.
<li>If <var>elt</var> is <a>connected</a>, part of the <a>flat tree</a>,
and its <a>shadow-including root</a>'s <a>browsing context</a> either doesn't have a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the root doesn't have a browsing context?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you put an example of a document which has no browsing context? It's not clear to me when can that happen.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is why I asked you for review btw, thanks a lot for taking a look :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new Document(), xhr.responseXML, new DOMParser().parseFromString(...), ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I think we don't want to return styles there either, since those documents have no rendering behavior. Pushed two fixups for the issues you raised, mind taking a look? Thanks!

@annevk
Copy link
Member

annevk commented Apr 16, 2018

This looks fine to me, editorially and behaviorally, but I do wonder whether it matches implementations. In my own testing many years ago I've found that getComputedStyle(someElementFromAnotherDocumentWithoutBrowsingContext) does end up returning styles, if I remember correctly.

It's probably worth accompanying this change with web-platform-tests. (I don't know if the CSS WG has such a policy yet, but at the WHATWG each normative change to a standard requires corresponding tests and bugs against failing implementations.)

@emilio
Copy link
Collaborator Author

emilio commented Apr 16, 2018

Yeah, we decided this in #1548. This is kind of a mess in terms of interop right now. I added tests for this in web-platform-tests/wpt#10422.

@emilio
Copy link
Collaborator Author

emilio commented Apr 16, 2018

Basically, this is where we want to move. It may not be possible to not return styles in display: none iframes because of web compat, but we decided to give it a shot.

@annevk
Copy link
Member

annevk commented Apr 16, 2018

Cool. I'd generally wait for at least one browser to ship before committing on the change in model, but seems like most things (apart from browser bugs) are covered here.

@fantasai fantasai removed the ready label Apr 20, 2018
@tabatkins tabatkins merged commit 00c78bc into w3c:master Apr 20, 2018
@emilio emilio deleted the 1548 branch April 21, 2018 10:06
fergald pushed a commit to fergald/csswg-drafts that referenced this pull request May 7, 2018
* [cssom] Make elements outside of the flat tree or detached not expose styles.

Fixes w3c#1548

* [cssom] Let elements in non-rendered iframes not expose styles.

Additional resolution in w3c#1548.

* fixup! [cssom] Make elements outside of the flat tree or detached not expose styles.

* fixup! [cssom] Let elements in non-rendered iframes not expose styles.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cssom-1 Current Work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants