Re: [csswg-drafts] [css-view-transitions-2] MPA: Reacting to the old/new page type (#8683)

I've been prototyping a bit with this. Let's say, when going between "home" and "article", I want to give `.banner-img` on the "article" a particular `view-transition-name`.

So, I want a rule like `.banner-img { view-transition-name: banner-img; }` to apply:

- On "article", when coming from "home"
- On "article", when going to "home"

In one of these cases, "article" is the old page, in the other it's the new page.

There are probably cases where you need to know all three bits of information:

- The current page type
- The old page type
- The new page type

But in this case, and seemingly a lot of similar cases, you only need to know:

- The current page type
- The 'other' page type

Being able to express that would reduce code. Eg:

```css
:root:vt-current-page-type(article):vt-other-page-type(home) .banner-img {
  view-transition-name: banner-img;
}
```

Compared to:

```css
:root:vt-current-page-type(article):vt-old-page-type(home),
:root:vt-current-page-type(article):vt-new-page-type(home) {
  & .banner-img {
    view-transition-name: banner-img;
  }
}
```

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


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

Received on Friday, 1 September 2023 09:13:47 UTC