mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(core): handle undefined CSS time values in parseCssTimeUnitsToMs function (#64181)
Improve error handling when `rawDelays` contains fewer items than `transitionedProperties`, preventing a toLowerCase of undefined error in `parseCssTimeUnitsToMs`. PR Close #64181
This commit is contained in:
committed by
Miles Malerba
parent
b22f73d54f
commit
cb56fbfddb
@@ -10,7 +10,8 @@ import {LView} from '../render3/interfaces/view';
|
||||
import {LongestAnimation} from './interfaces';
|
||||
|
||||
/** Parses a CSS time value to milliseconds. */
|
||||
function parseCssTimeUnitsToMs(value: string): number {
|
||||
function parseCssTimeUnitsToMs(value: string | undefined): number {
|
||||
if (!value) return 0;
|
||||
// Some browsers will return it in seconds, whereas others will return milliseconds.
|
||||
const multiplier = value.toLowerCase().indexOf('ms') > -1 ? 1 : 1000;
|
||||
return parseFloat(value) * multiplier;
|
||||
|
||||
Reference in New Issue
Block a user