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

fix($animate): do not get affected by custom, enumerable properties on Object.prototype #14830

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ngAnimate/animateQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
}
);

var callbackRegistry = {};
var callbackRegistry = Object.create(null);

// remember that the classNameFilter is set during the provider/config
// stage therefore we can optimize here and setup a helper function
Expand Down
11 changes: 11 additions & 0 deletions test/ngAnimate/animateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,17 @@ describe("animations", function() {
expect(count).toBe(5);
}));

it('should not get affected by custom, enumerable properties on `Object.prototype`',
inject(function($animate) {
Object.prototype.foo = 'ENUMARABLE_AND_NOT_AN_ARRAY';

element = jqLite('<div></div>');
expect(function() { $animate.off(element); }).not.toThrow();

delete Object.prototype.foo;
})
);

it('should fire a `start` callback when the animation starts with the matching element',
inject(function($animate, $rootScope, $rootElement, $document) {

Expand Down