mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(animation): improve compatibility with ssr (#25992)
resolves #25987
This commit is contained in:
@@ -114,7 +114,8 @@ export const generateKeyframeName = (keyframeRules: string) => {
|
||||
};
|
||||
|
||||
export const getStyleContainer = (element: HTMLElement) => {
|
||||
const rootNode = element.getRootNode() as any;
|
||||
// getRootNode is not always available in SSR environments.
|
||||
const rootNode = element.getRootNode !== undefined ? (element.getRootNode() as any) : element;
|
||||
return rootNode.head || rootNode;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { raf } from '../helpers';
|
||||
import { win } from '../window';
|
||||
|
||||
import type {
|
||||
Animation,
|
||||
@@ -83,7 +84,8 @@ export const createAnimation = (animationId?: string): Animation => {
|
||||
const _afterAddWriteFunctions: any[] = [];
|
||||
const webAnimations: any[] = [];
|
||||
const supportsAnimationEffect =
|
||||
typeof (AnimationEffect as any) === 'function' || typeof (window as any).AnimationEffect === 'function';
|
||||
typeof (AnimationEffect as any) === 'function' ||
|
||||
(win !== undefined && typeof (win as any).AnimationEffect === 'function');
|
||||
const supportsWebAnimations =
|
||||
typeof (Element as any) === 'function' &&
|
||||
typeof (Element as any).prototype!.animate === 'function' &&
|
||||
|
||||
Reference in New Issue
Block a user