Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

ngAnimate not working properly on Firefox 21 (Latest Stable) #3053

Closed
gsklee opened this issue Jun 25, 2013 · 4 comments
Closed

ngAnimate not working properly on Firefox 21 (Latest Stable) #3053

gsklee opened this issue Jun 25, 2013 · 4 comments

Comments

@gsklee
Copy link
Contributor

gsklee commented Jun 25, 2013

http://plnkr.co/edit/wJ9vFV79Th45ZZzaqTdx

If you open it with Firefox, you'll see that the enter animation is constantly not being triggered; on the other hand it is totally working fine on Chrome.

@carlhopf
Copy link

just spent some time on a somewhat hackish fix for that:

diff --git a/src/lib/angular.hacked.js b/src/lib/angular.hacked.js
index 703ecb6..cc809b4 100644
--- a/src/lib/angular.hacked.js
+++ b/src/lib/angular.hacked.js
@@ -3412,6 +3412,20 @@ var $AnimatorProvider = function() {
             function beginAnimation() {
               element.addClass(activeClassName);
               if (polyfillStart) {
+                // firefox bugfix, else animation wont play most of the times
+                // accessing  the computedStyle seems to fix the issue
+                if(isFunction($window.getComputedStyle)) {
+                  forEach(element, function(element) {
+                    if (element.nodeType == 1) {
+                      var elementStyles = $window.getComputedStyle(element) || {};
+                      elementStyles['animationDuration'];
+                      elementStyles[$sniffer.vendorPrefix + 'AnimationDuration'];
+                    }
+                  });
+                }
+
                 polyfillStart(element, done, memento);
               } else if (isFunction($window.getComputedStyle)) {
                 //one day all browsers will have these properties

reading the computedStyle() duration keys fixes the issue for me.

@matsko
Copy link
Contributor

matsko commented Jul 31, 2013

@gsklee could you try changing the setTimeout duration inside of the animator code to something higher than what it currently is (which is just 1) to see if that makes it work?

@matsko
Copy link
Contributor

matsko commented Oct 12, 2013

@gsklee I'm super happy that you brought this up because this (if not handled) would've caused a huge issue in 1.2.rc3.

matsko added a commit to matsko/angular.js that referenced this issue Oct 12, 2013
…the browser event

Firefox and (sometimes) Opera may not provide a timeStamp value in their event when passed
to the event handler. This may cause animations not to close properly. This fix will automatically
create a timeStamp value for the event in this situation when missing.

Closes angular#3053
@matsko matsko closed this as completed in cd216c4 Oct 12, 2013
@matsko
Copy link
Contributor

matsko commented Oct 12, 2013

Landed as cd216c4

jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
…the browser event

Firefox and (sometimes) Opera may not provide a timeStamp value in their event when passed
to the event handler. This may cause animations not to close properly. This fix will automatically
create a timeStamp value for the event in this situation when missing.

Closes angular#3053
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
…the browser event

Firefox and (sometimes) Opera may not provide a timeStamp value in their event when passed
to the event handler. This may cause animations not to close properly. This fix will automatically
create a timeStamp value for the event in this situation when missing.

Closes angular#3053
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants