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

Commit 81fe30b

Browse files
committed
chore: replace jqLite($document[0].body) with $$body
1 parent bc769ab commit 81fe30b

File tree

8 files changed

+119
-124
lines changed

8 files changed

+119
-124
lines changed

src/ngAnimate/animateCssDriver.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ var $$AnimateCssDriverProvider = ['$$animationProvider', function($$animationPro
99
var NG_OUT_ANCHOR_CLASS_NAME = 'ng-anchor-out';
1010
var NG_IN_ANCHOR_CLASS_NAME = 'ng-anchor-in';
1111

12-
this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$document', '$sniffer',
13-
function($animateCss, $rootScope, $$AnimateRunner, $rootElement, $document, $sniffer) {
12+
this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$$body', '$sniffer',
13+
function($animateCss, $rootScope, $$AnimateRunner, $rootElement, $$body, $sniffer) {
1414

1515
// only browsers that support these properties can render animations
1616
if (!$sniffer.animations && !$sniffer.transitions) return noop;
1717

18-
var bodyNode = getDomNode($document).body;
18+
var bodyNode = getDomNode($$body);
1919
var rootNode = getDomNode($rootElement);
2020

2121
var rootBodyElement = jqLite(bodyNode.parentNode === rootNode ? bodyNode : rootNode);

src/ngAnimate/animateQueue.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
6666
return (nO.addClass && nO.addClass === cO.removeClass) || (nO.removeClass && nO.removeClass === cO.addClass);
6767
});
6868

69-
this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$HashMap',
69+
this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$body', '$$HashMap',
7070
'$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite',
71-
function($$rAF, $rootScope, $rootElement, $document, $$HashMap,
71+
function($$rAF, $rootScope, $rootElement, $document, $$body, $$HashMap,
7272
$$animation, $$AnimateRunner, $templateRequest, $$jqLite) {
7373

7474
var activeAnimationsLookup = new $$HashMap();
@@ -105,8 +105,6 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
105105
}
106106
);
107107

108-
var bodyElement = jqLite($document[0].body);
109-
110108
var callbackRegistry = {};
111109

112110
// remember that the classNameFilter is set during the provider/config
@@ -580,7 +578,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
580578
if (!bodyElementDetected) {
581579
// we also need to ensure that the element is or will be apart of the body element
582580
// otherwise it is pointless to even issue an animation to be rendered
583-
bodyElementDetected = isMatchingElement(parentElement, bodyElement);
581+
bodyElementDetected = isMatchingElement(parentElement, $$body);
584582
}
585583

586584
parentElement = parentElement.parent();

test/ng/directive/ngClassSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -468,12 +468,12 @@ describe('ngClass animations', function() {
468468
};
469469
});
470470
});
471-
inject(function($compile, $rootScope, $browser, $rootElement, $animate, $timeout, $document, $$rAF) {
471+
inject(function($compile, $rootScope, $browser, $rootElement, $animate, $timeout, $$body, $$rAF) {
472472
$animate.enabled(true);
473473

474474
$rootScope.val = 'crazy';
475475
element = angular.element('<div ng-class="val"></div>');
476-
jqLite($document[0].body).append($rootElement);
476+
$$body.append($rootElement);
477477

478478
$compile(element)($rootScope);
479479

test/ngAnimate/animateCssDriverSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ describe("ngAnimate $$animateCssDriver", function() {
118118
var from, to, fromAnimation, toAnimation;
119119

120120
beforeEach(module(function() {
121-
return function($rootElement, $document) {
121+
return function($rootElement, $$body) {
122122
from = element;
123123
to = jqLite('<div></div>');
124124
fromAnimation = { element: from, event: 'enter' };
@@ -127,7 +127,7 @@ describe("ngAnimate $$animateCssDriver", function() {
127127
$rootElement.append(to);
128128

129129
// we need to do this so that style detection works
130-
jqLite($document[0].body).append($rootElement);
130+
$$body.append($rootElement);
131131
};
132132
}));
133133

0 commit comments

Comments
 (0)