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

fix(ngAnimate): do not assume $document[0] exists #11997

Closed
wants to merge 1 commit into from
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
10 changes: 5 additions & 5 deletions src/ngAnimate/animateQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
return (nO.addClass && nO.addClass === cO.removeClass) || (nO.removeClass && nO.removeClass === cO.addClass);
});

this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$HashMap',
'$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite',
function($$rAF, $rootScope, $rootElement, $document, $$HashMap,
$$animation, $$AnimateRunner, $templateRequest, $$jqLite) {
this.$get = ['$$rAF', '$rootScope', '$rootElement', '$$HashMap', '$$animation',
'$$AnimateRunner', '$templateRequest', '$$jqLite',
function($$rAF, $rootScope, $rootElement, $$HashMap, $$animation,
$$AnimateRunner, $templateRequest, $$jqLite) {

var activeAnimationsLookup = new $$HashMap();
var disabledElementsLookup = new $$HashMap();
Expand Down Expand Up @@ -105,7 +105,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
}
);

var bodyElement = jqLite($document[0].body);
var bodyElement = jqLite(document.body);

var callbackRegistry = {};

Expand Down
5 changes: 5 additions & 0 deletions test/ng/windowSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ describe('$window', function() {
module({$window: {}});
inject(['$sce', angular.noop]);
});

it('should be able to mock $window with $animate', function() {
module('ngAnimate', {$window: {}});
inject(['$animate', angular.noop]);
});
});