Re: [csswg-drafts] [selectors-4] Add pseudo-class to establish before-change style for css-transitions on new elements. (#8174)

> > Whether to start a transition also seems to depend on the before-change transition duration ([demo](https://jsbin.com/pubineq/5/edit?html,css,js,output)) though it's unclear from [the spec](https://www.w3.org/TR/css-transitions-1/#matching-transition-duration) whether this is right.
> 
> @flackr That demo has a mistake which makes it seem like the before-style matters (for the transition properties), but it actually doesn't ([fixed demo](https://jsbin.com/wugecum/edit?html,css,js,output), the difference is the `<div class="target closed">` part). Spec also seems clear that the "matching transition property value" (etc) is taken from the after-change style. So I think we're good?

Yup! That's great! So we'll only need to do this when we have a non-zero transition duration making this a good optimization.

> > Also, will this support combinator selectors from :initial?
> 
> Right ... so e.g. does `.a:initial > .b` imply that a before-change style for `.b` exists? That sounds complicated. Maybe this concept is closer to a _pseudo-element_: we could use `dialog::initial` instead to avoid all these questions. Pseudo-elements representing a real element in a certain state is not entirely without precedent (`::slotted()`), although a pseudo-element being its own originating element is perhaps new. :-)

Yes, this sounds perfect. I think it's reasonable to require `.a > .b::initial` in this particular example, and if we take a more confusing example `.a:initial + .b`, if `.b` already existed it should just be using its already established before-change style, and if it didn't the developer could have used `.a + .b::initial`



-- 
GitHub Notification of comment by flackr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8174#issuecomment-1342955586 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 8 December 2022 16:07:50 UTC