diff --git a/src/ng/animator.js b/src/ng/animator.js index 536c93c13b7d..d79822f7cd20 100644 --- a/src/ng/animator.js +++ b/src/ng/animator.js @@ -272,14 +272,17 @@ var $AnimatorProvider = function() { var durationKey = 'Duration'; var duration = 0; + //we want all the styles defined before and after forEach(element, function(element) { - var globalStyles = $window.getComputedStyle(element) || {}; - duration = Math.max( - parseFloat(globalStyles[w3cTransitionProp + durationKey]) || - parseFloat(globalStyles[vendorTransitionProp + durationKey]) || - 0, - duration); + if (element.nodeType == 1) { + var globalStyles = $window.getComputedStyle(element) || {}; + duration = Math.max( + parseFloat(globalStyles[w3cTransitionProp + durationKey]) || + parseFloat(globalStyles[vendorTransitionProp + durationKey]) || + 0, + duration); + } }); $window.setTimeout(done, duration * 1000); } else { diff --git a/src/ng/directive/ngView.js b/src/ng/directive/ngView.js index d5ef2c71ad48..b553544c4237 100644 --- a/src/ng/directive/ngView.js +++ b/src/ng/directive/ngView.js @@ -194,9 +194,10 @@ var ngViewDirective = ['$http', '$templateCache', '$route', '$anchorScroll', '$c if (template) { clearContent(); - animate.enter(jqLite('
').html(template).contents(), element); + var enterElements = jqLite('').html(template).contents(); + animate.enter(enterElements, element); - var link = $compile(element.contents()), + var link = $compile(enterElements), current = $route.current, controller; diff --git a/test/ng/directive/ngViewSpec.js b/test/ng/directive/ngViewSpec.js index 579fd0a88e0f..c31c24491593 100644 --- a/test/ng/directive/ngViewSpec.js +++ b/test/ng/directive/ngViewSpec.js @@ -3,7 +3,8 @@ describe('ngView', function() { var element; - beforeEach(module(function() { + beforeEach(module(function($provide) { + $provide.value('$window', angular.mock.createMockWindow()); return function($rootScope, $compile, $animator) { element = $compile('