You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
do you know if there are browser versions that support the startViewTransition function, but only with a closure parameter and not the object parameter? if yes, then for these browsers the fallback if (document.startViewTransition) {} else {} would not work and i'm not sure how to write it.
@fabb Yes some browsers will only work with the callback. You can do that :
interfaceViewTransitionParams{update: ()=>void|Promise<void>;types: string[]}functionviewTransition(params: ViewTransitionParams){if(!('startViewTransition'indocument)){// View transition is not supportedreturnparams.update();}try{// View transition is supported with paramsreturndocument.startViewTransition(params);}catch{// View transition is supported with callbackreturndocument.startViewTransition(params.update);}}
Missing
types
startViewTransition
now support an object as parameter{ update: () => void | Promise<void>; types: string[] }
https://developer.chrome.com/docs/web-platform/view-transitions/same-document#view-transition-types
Also the
ViewTransition
object now includes atypes
key of typeViewTransitionTypeSet
which implement the Set object.Missing
viewTransitionClass
inCSSStyleDeclaration
The
view-transition-class
declaration should be included in theCSSStyleDeclaration
https://developer.chrome.com/docs/web-platform/view-transitions/same-document#view-transition-class
This feature is supported by Chome (125) and Safari (18).
Note: Both features are not available on MDN yet as for today (27 January 2024)
The text was updated successfully, but these errors were encountered: