fix(animations): throw errors and normalize offset beyond the range of [0,1]

Closes #13348
Closes #13440
This commit is contained in:
Matias Niemelä
2016-12-12 15:22:16 -08:00
committed by Victor Berchet
parent 8395f0e138
commit b56474d067
4 changed files with 76 additions and 1 deletions

View File

@ -174,6 +174,11 @@ function _normalizeStyleMetadata(
entry: CompileAnimationStyleMetadata, stateStyles: {[key: string]: AnimationStylesAst},
schema: ElementSchemaRegistry, errors: AnimationParseError[],
permitStateReferences: boolean): {[key: string]: string | number}[] {
const offset = entry.offset;
if (offset > 1 || offset < 0) {
errors.push(new AnimationParseError(`Offset values for animations must be between 0 and 1`));
}
const normalizedStyles: {[key: string]: string | number}[] = [];
entry.styles.forEach(styleEntry => {
if (typeof styleEntry === 'string') {