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

ngAnimate + $$RAFProvider : crashes when browser doesn't support requestAnimationFrame or is prefixed with 'moz' #6535

Closed

Description

@atomrc

The RAFProvider is adding a supported property to indicate whether the browser supports or not the requestAnimationFrame (see

raf.supported = !!requestAnimationFrame;
) but the ngAnimate doesn't check this property before using it (see https://github.com/angular/angular.js/blob/master/src/ngAnimate/animate.js#L261).

I would be happy to make a pull request on this but my question is :
is it best to add a fallback on a timeout directly in the RAFProvider or to check for the supportedproperty every time it is used ?

I think just adding the mozRequestAnimationFrame would be a good start.

Activity

  1. matsko commented on Mar 4, 2014

    @matsko
    Contributor

    Yes let's add mozRequestAnimationFrame. All browsers that support CSS animations/transitions also support RAF, therefore, there is no reason to fallback to timeout anymore.

    I didn't think that Firefox still needed it. I guess the error showed up on an older version of FF.

  2. matsko commented on Mar 4, 2014

    @matsko
    Contributor

    Can you verify that adding mozRequestAnimationFrame and mozCancelAnimationFrame fixes the issue?

  3. atomrc commented on Mar 4, 2014

    @atomrc
    Author

    Yes indeed the error occurs in an old version of FF (20).
    The fact is that if the browser doesn't support RAF (I am thinking of IE8 for example) the code will simply crash.
    What is weird is that there is the property supported (false if the browser doesn't support rAF) but it is never checked wherever the rAF service is used.

  4. self-assigned this
    on Mar 6, 2014
  5. added this to the milestone on Mar 6, 2014
  6. removed their assignment
    on Mar 6, 2014
  7. mgol commented on Mar 14, 2014

    @mgol
    Member

    @matsko

    All browsers that support CSS animations/transitions also support RAF

    That's not true. Opera has had transitions since 10.5 (which is really old) and even the latest Presto-based version, 12.16 doesn't have rAF. Opera Presto is still popular in some countries like Russia.

  8. matsko commented on Mar 14, 2014

    @matsko
    Contributor

    Right. Yes. My mistake on this. I'm putting together a patch that uses the $timeout code with a low value: $timeout(callback, 1000 / 60); and updating the tests to support it.

  9. mgol commented on Mar 14, 2014

    @mgol
    Member

    @matsko If you're putting the timeout in, maybe the moz-prefixed version doesn't matter anymore? Hardly anyone uses old Fx versions so it's mostly so that they work, not necessarily in the most performant way.

    Angular 2.0 is a rewrite anyway so the $timeout fallback will live in Angular 1.x forever.

  10. tbosch commented on Mar 14, 2014

    @tbosch
    Contributor

    I agree with @mzgol, e.g. Android 2.3 browsers don't support rAF but do support CSS transitions/animations.

  11. mgol commented on Mar 14, 2014

    @mgol
    Member

    @tbosch Not only 2.3. :) No Android Browser version supports requestAnimationFrame, only Chrome mobile does: http://caniuse.com/requestanimationframe

  12. dcherman commented on Sep 27, 2015

    @dcherman
    Contributor

    Why are we adding this? Per the browser support policy at https://docs.angularjs.org/misc/faq#what-browsers-does-angular-work-with-, only the latest versions of Firefox are supported; it's a hard sell to consider 20 as a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions