fix(animations): repair flicker issues with WA polyfill (#16937)
Fixes #16919 Fixes #16918
This commit is contained in:

committed by
Chuck Jazdzewski

parent
08dfe91b95
commit
e7d9fd8056
@ -123,16 +123,18 @@ export function copyStyles(
|
||||
|
||||
export function setStyles(element: any, styles: ɵStyleData) {
|
||||
if (element['style']) {
|
||||
Object.keys(styles).forEach(prop => element.style[prop] = styles[prop]);
|
||||
Object.keys(styles).forEach(prop => {
|
||||
const camelProp = dashCaseToCamelCase(prop);
|
||||
element.style[camelProp] = styles[prop];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function eraseStyles(element: any, styles: ɵStyleData) {
|
||||
if (element['style']) {
|
||||
Object.keys(styles).forEach(prop => {
|
||||
// IE requires '' instead of null
|
||||
// see https://github.com/angular/angular/issues/7916
|
||||
element.style[prop] = '';
|
||||
const camelProp = dashCaseToCamelCase(prop);
|
||||
element.style[camelProp] = '';
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -206,3 +208,8 @@ export function mergeAnimationOptions(
|
||||
}
|
||||
return destination;
|
||||
}
|
||||
|
||||
const DASH_CASE_REGEXP = /-+([a-z0-9])/g;
|
||||
export function dashCaseToCamelCase(input: string): string {
|
||||
return input.replace(DASH_CASE_REGEXP, (...m: any[]) => m[1].toUpperCase());
|
||||
}
|
||||
|
Reference in New Issue
Block a user