To ensure compatibility across different browsers, the script uses a wrapper function called `mayViewTransition`. This wrapper checks if the native view transition API is supported. If it is, `document.startViewTransition` is called; if not, the DOM-changing code is called directly. This approach is a best practice for using `document.startViewTransition`, as it prevents errors in browsers that lack native support for view transitions.
0 commit comments