/
githubmirror
/
ionic-framework
Обзор
Документация
Войти
/
githubmirror
/
ionic-framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
core/src/utils/animation/animation-utils.ts
25 строк
970 B
Sean Perkins
feat: remove css animations support for ionic animations (#29123)
20 мар 2024, 18:23
Не верифицирован
20 мар 2024, 18:23
892594d
Код
Авторство
О чём код?
let animationPrefix: string | undefined; export const getAnimationPrefix = (el: HTMLElement): string => { if (animationPrefix === undefined) { const supportsUnprefixed = el.style.animationName !== undefined; const supportsWebkitPrefix = el.style.webkitAnimationName !== undefined; animationPrefix = !supportsUnprefixed && supportsWebkitPrefix ? '-webkit-' : ''; } return animationPrefix; }; export const setStyleProperty = (element: HTMLElement, propertyName: string, value: string | null) => { const prefix = propertyName.startsWith('animation') ? getAnimationPrefix(element) : ''; element.style.setProperty(prefix + propertyName, value); }; export const addClassToArray = (classes: string[] = [], className: string | string[] | undefined): string[] => { if (className !== undefined) { const classNameToAppend = Array.isArray(className) ? className : [className]; return [...classes, ...classNameToAppend]; } return classes; };