New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getAnimationStyle causes exceptions in older browsers #24094
Comments
Any progress on this issue? It now causes issues with PhantomJS tests |
It seems that no one cares about this issue. My temporary solution/workaround to prevent errors, looks like this:
This will disable animations in problematic browsers. |
@janousek I've solved issue on my side with a polyfill, added this code to if (document.body.style.animation === undefined && CSSStyleDeclaration) {
CSSStyleDeclaration.prototype.animation = '';
}
if (document.body.style['animation-name'] === undefined && CSSStyleDeclaration) {
CSSStyleDeclaration.prototype['animation-name'] = '';
CSSStyleDeclaration.prototype['animationName'] = '';
}
if (document.body.style['animation-duration'] === undefined && CSSStyleDeclaration) {
CSSStyleDeclaration.prototype['animation-duration'] = '';
CSSStyleDeclaration.prototype['animationDuration'] = '';
}
if (document.body.style['animation-play-state'] === undefined && CSSStyleDeclaration) {
CSSStyleDeclaration.prototype['animation-play-state'] = '';
CSSStyleDeclaration.prototype['animationPlayState'] = '';
} Only the last one (with |
@janousek i fixed my issue with using NoopAnimationsModule in my unit-test |
I think you can get pretty far by adding some vendor prefix checks at these 2 points angular/packages/animations/browser/src/render/css_keyframes/css_keyframes_driver.ts Line 43 in 6482f6f
angular/packages/animations/browser/src/render/css_keyframes/element_animation_style_handler.ts Line 9 in cf0968f
maybe simply something like this? function vendorPrefix() {
return ['', '-webkit-', '-moz-', '-o-'].find((prefix) =>
document.body.style[prefix+'animation'] !== undefined || ''
)
}
// [...]
let keyframeStr = `@${vendorPrefix()}keyframes ${name} {\n`;
// [...]
const ANIMATION_PROP = vendorPrefix()+'animation'; This approach requires calls to angular/packages/animations/browser/src/render/css_keyframes/element_animation_style_handler.ts Line 43 in cf0968f
angular/packages/animations/browser/src/render/css_keyframes/element_animation_style_handler.ts Line 75 in cf0968f
Thoughts? |
have the same problem:
Errors on the following User-Agents:
FYI duplicate issue #25563 |
@omieliekh your solution will break angular material dropdowns in Safari. |
Is there still no fix for this? |
This error also seems to occur in Chrome 70 on Windows 10 because I just got the same error message in my client's Angular app through Sentry: https://sentry.io/share/issue/8c7da85210424e63b96c8f7a10bc9435/ |
Is there any hope for this being solved soon? |
So, this has been blowing up our Sentry logging, and it's an absolutely tiny fix with a PR that has no chance of causing issues, and has been sitting in the queue forever. Seems unfortunate that it's taken over 2 years and several conversations to fail to change a single reference. |
@danwhitston - sorry that this has not yet been solved. Now that @matsko has left the team, such issues are not getting as much attention as they deserve. Are you able to test the fix given in #29709 for your scenario? If it works for you, I would be willing to try to get it merged. |
Closing this issue since corresponding PR #29709 was merged and should be available in the next Angular release (v11.0.3). Thank you. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a...
Current behavior
Errors are thrown during collection of animation styles (in older browsers).
The problem is on this line:
angular/packages/animations/browser/src/render/css_keyframes/element_animation_style_handler.ts
Line 137 in 13cb75d
Most of browsers will return empty string if the style property is not set. But some browsers (like Chrome on Android 4.4) returns null instead of empty string.
Several string functions are applied on the output of the method "getAnimationStyle" - like trim, split, indexOf, etc... But if the output of the"getAnimationStyle" is null, exception is thrown.
Simple fix of this bug:
Expected behavior
Animation should work without errors.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Environment
The text was updated successfully, but these errors were encountered: