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: lookUpAnimations function breaks if CSS class is an Array.prototype function name. #11619

Closed
@rvignacio

Description

@rvignacio

Hello, I'm having a problem with the lookUpAnimations function in src/ngAnimate/animateJs.js. It iterates over the CSS classes of the element and gets the registered animation provider:

// Extract from src/ngAnimate/animateJs.js#L241
var klass = classes[i],
    animationFactory = $animateProvider.$$registeredAnimations[klass];
if (animationFactory && !flagMap[klass]) {
  matches.push($injector.get(animationFactory));
  flagMap[klass] = true;
}

My element has a CSS class named "filter" so, when doing:
animationFactory = $animateProvider.$$registeredAnimations[klass];
the animationFactory variable ends up being a reference to Array.prototype.filter (because $$registeredAnimations is of type Array). After that, I got an unknown provider exception because it calls $injector.get() with the filter function.

I already changed the CSS class, but shouldn't $$registeredAnimations be just a plain object (like Object.create(null)) instead of an Array if it's going to be used that way?

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions