Re: [csswg-drafts] [css-view-transitions-2] Script event on old Document for cross-document ViewTransitions (#8785)

I want us to consider how this could create a gotcha with BFCache.
Let's use the example in the OP:
```js
document.addEventListener("viewtransitionbeforecapture", (event) => {
  // Cancel the transition (based on new URL) if needed.
 /* ... */

  // Set up names on elements based on the new URL.
  if (shouldTagThumbnail(event.toURL)) {
    thumbnail.style.viewTransitionName = "full-embed";
  }
});
```

If after doing this the document is saved to BFCache and then restored, it would be restored with `thumbnail.style.viewTransitionName === "full-embed". 

Not sure if there is a way around this or if this should stop us from doing this, but wanted it to be documented.

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


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

Received on Friday, 17 November 2023 17:16:24 UTC