aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ng/animate.js15
-rw-r--r--test/ng/directive/ngIncludeSpec.js25
2 files changed, 33 insertions, 7 deletions
diff --git a/src/ng/animate.js b/src/ng/animate.js
index bb08410c..b662d9c1 100644
--- a/src/ng/animate.js
+++ b/src/ng/animate.js
@@ -99,13 +99,14 @@ var $AnimateProvider = ['$provide', function($provide) {
* inserted into the DOM
*/
enter : function(element, parent, after, done) {
- var afterNode = after && after[after.length - 1];
- var parentNode = parent && parent[0] || afterNode && afterNode.parentNode;
- // IE does not like undefined so we have to pass null.
- var afterNextSibling = (afterNode && afterNode.nextSibling) || null;
- forEach(element, function(node) {
- parentNode.insertBefore(node, afterNextSibling);
- });
+ if (after) {
+ after.after(element);
+ } else {
+ if (!parent || !parent[0]) {
+ parent = after.parent();
+ }
+ parent.append(element);
+ }
done && $timeout(done, 0, false);
},
diff --git a/test/ng/directive/ngIncludeSpec.js b/test/ng/directive/ngIncludeSpec.js
index aba71e44..59f8b4ae 100644
--- a/test/ng/directive/ngIncludeSpec.js
+++ b/test/ng/directive/ngIncludeSpec.js
@@ -312,6 +312,31 @@ describe('ngInclude', function() {
}));
+ it('should exec scripts when jQuery is included', inject(function($compile, $rootScope, $httpBackend) {
+ if (!jQuery) {
+ return;
+ }
+
+ element = $compile('<div><span ng-include="includeUrl"></span></div>')($rootScope);
+
+ // the element needs to be appended for the script to run
+ element.appendTo(document.body);
+ window._ngIncludeCausesScriptToRun = false;
+ $httpBackend.expect('GET', 'url1').respond('<script>window._ngIncludeCausesScriptToRun = true;</script>');
+ $rootScope.includeUrl = 'url1';
+ $rootScope.$digest();
+ $httpBackend.flush();
+
+ expect(window._ngIncludeCausesScriptToRun).toBe(true);
+
+ // IE8 doesn't like deleting properties of window
+ window._ngIncludeCausesScriptToRun = undefined;
+ try {
+ delete window._ngIncludeCausesScriptToRun;
+ } catch (e) {}
+ }));
+
+
describe('autoscroll', function() {
var autoScrollSpy;