-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Animation Fixes #12881
Animation Fixes #12881
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,16 +9,25 @@ var $$AnimateCssDriverProvider = ['$$animationProvider', function($$animationPro | |
var NG_OUT_ANCHOR_CLASS_NAME = 'ng-anchor-out'; | ||
var NG_IN_ANCHOR_CLASS_NAME = 'ng-anchor-in'; | ||
|
||
this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$$body', '$sniffer', '$$jqLite', | ||
function($animateCss, $rootScope, $$AnimateRunner, $rootElement, $$body, $sniffer, $$jqLite) { | ||
function isDocumentFragment(node) { | ||
return node.parentNode && node.parentNode.nodeType === 11; | ||
} | ||
|
||
this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$sniffer', '$$jqLite', '$document', | ||
function($animateCss, $rootScope, $$AnimateRunner, $rootElement, $sniffer, $$jqLite, $document) { | ||
|
||
// only browsers that support these properties can render animations | ||
if (!$sniffer.animations && !$sniffer.transitions) return noop; | ||
|
||
var bodyNode = getDomNode($$body); | ||
var bodyNode = $document[0].body; | ||
var rootNode = getDomNode($rootElement); | ||
|
||
var rootBodyElement = jqLite(bodyNode.parentNode === rootNode ? bodyNode : rootNode); | ||
var rootBodyElement = jqLite( | ||
// this is to avoid using something that sites outside of the body | ||
// we also special case the doc fragement case because our unit test code | ||
// appens the $rootElement to the body after the app has been bootstrapped | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
isDocumentFragment(rootNode) || bodyNode.contains(rootNode) ? rootNode : bodyNode | ||
); | ||
|
||
var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); | ||
|
||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,16 +121,22 @@ describe("ngAnimate $$animateCssDriver", function() { | |
var from, to, fromAnimation, toAnimation; | ||
|
||
beforeEach(module(function() { | ||
return function($rootElement, $$body) { | ||
return function($rootElement, $document) { | ||
from = element; | ||
to = jqLite('<div></div>'); | ||
fromAnimation = { element: from, event: 'enter' }; | ||
toAnimation = { element: to, event: 'leave' }; | ||
$rootElement.append(from); | ||
$rootElement.append(to); | ||
|
||
// we need to do this so that style detection works | ||
$$body.append($rootElement); | ||
var doc = $document[0]; | ||
|
||
// there is one test in here that expects the rootElement | ||
// to superceed the body node | ||
if (!$rootElement[0].contains(doc.body)) { | ||
// we need to do this so that style detection works | ||
jqLite(doc.body).append($rootElement); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doing this kind of conditional work in But anyway, not to worry here on this occasion. |
||
}; | ||
})); | ||
|
||
|
@@ -975,6 +981,39 @@ describe("ngAnimate $$animateCssDriver", function() { | |
|
||
expect(completed).toBe(true); | ||
})); | ||
|
||
it("should use <body> as the element container if the rootElement exists outside of the <body> tag", function() { | ||
module(function($provide) { | ||
$provide.factory('$rootElement', function($document) { | ||
return jqLite($document[0].querySelector('html')); | ||
}); | ||
}); | ||
inject(function($rootElement, $rootScope, $animate, $document) { | ||
ss.addRule('.ending-element', 'width:9999px; height:6666px; display:inline-block;'); | ||
|
||
var fromAnchor = jqLite('<div></div>'); | ||
from.append(fromAnchor); | ||
|
||
var toAnchor = jqLite('<div></div>'); | ||
to.append(toAnchor); | ||
|
||
$rootElement.append(fromAnchor); | ||
$rootElement.append(toAnchor); | ||
|
||
var completed = false; | ||
driver({ | ||
from: fromAnimation, | ||
to: toAnimation, | ||
anchors: [{ | ||
'out': fromAnchor, | ||
'in': toAnchor | ||
}] | ||
}).start(); | ||
|
||
var clone = captureLog[2].element[0]; | ||
expect(clone.parentNode).toBe($document[0].body); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sites
? should this belives
orexists
?