@@ -1669,6 +1669,12 @@ function customizeViewTransitionError(
1669
1669
return error ;
1670
1670
}
1671
1671
1672
+ /** @noinline */
1673
+ function forceLayout ( ownerDocument : Document ) {
1674
+ // This function exists to trick minifiers to not remove this unused member expression.
1675
+ return ( ownerDocument . documentElement : any ) . clientHeight ;
1676
+ }
1677
+
1672
1678
export function startViewTransition (
1673
1679
rootContainer : Container ,
1674
1680
transitionTypes : null | TransitionTypes ,
@@ -1698,8 +1704,7 @@ export function startViewTransition(
1698
1704
mutationCallback ( ) ;
1699
1705
if ( previousFontLoadingStatus === 'loaded' ) {
1700
1706
// Force layout calculation to trigger font loading.
1701
- // eslint-disable-next-line ft-flow/no-unused-expressions
1702
- ( ownerDocument . documentElement : any ) . clientHeight ;
1707
+ forceLayout ( ownerDocument ) ;
1703
1708
if (
1704
1709
// $FlowFixMe[prop-missing]
1705
1710
ownerDocument . fonts . status === 'loading'
@@ -1898,6 +1903,10 @@ export function startGestureTransition(
1898
1903
? ( rootContainer : any )
1899
1904
: rootContainer . ownerDocument ;
1900
1905
try {
1906
+ // Force layout before we start the Transition. This works around a bug in Safari
1907
+ // if one of the clones end up being a stylesheet that isn't loaded or uncached.
1908
+ // https://bugs.webkit.org/show_bug.cgi?id=290146
1909
+ forceLayout ( ownerDocument ) ;
1901
1910
// $FlowFixMe[prop-missing]
1902
1911
const transition = ownerDocument . startViewTransition ( {
1903
1912
update : mutationCallback ,
0 commit comments