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

Commit 103a39c

Browse files
committed
fix($animate): make sure the JS animation lookup is an object lookup
The lookup type was an array before, but it should be an empty object. Closes #11619
1 parent 042558a commit 103a39c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/ng/animate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ var $$CoreAnimateQueueProvider = function() {
163163
var $AnimateProvider = ['$provide', function($provide) {
164164
var provider = this;
165165

166-
this.$$registeredAnimations = [];
166+
this.$$registeredAnimations = Object.create(null);
167167

168168
/**
169169
* @ngdoc method

test/ng/animateSpec.js

+15
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,21 @@ describe("$animate", function() {
115115
inject();
116116
});
117117

118+
it("should register the animation and be available for lookup", function() {
119+
var provider;
120+
module(function($animateProvider) {
121+
provider = $animateProvider;
122+
});
123+
inject(function() {
124+
// by using hasOwnProperty we know for sure that the lookup object is an empty object
125+
// instead of inhertiting properties from its original prototype.
126+
expect(provider.$$registeredAnimations.hasOwnProperty).toBeFalsy();
127+
128+
provider.register('.filter', noop);
129+
expect(provider.$$registeredAnimations['filter']).toBe('.filter-animation');
130+
});
131+
});
132+
118133
it("should apply and retain inline styles on the element that is animated", inject(function($animate, $rootScope) {
119134
var element = jqLite('<div></div>');
120135
var parent = jqLite('<div></div>');

0 commit comments

Comments
 (0)