From e46100f7097d9a8f174bdb9e15d4c6098395c3f2 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 24 May 2013 12:41:38 -0700 Subject: feat($compile): support multi-element directive By appending directive-start and directive-end to a directive it is now possible to have the directive act on a group of elements. It is now possible to iterate over multiple elements like so: I get repeatedI also get repeated
--- src/ng/animator.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/ng/animator.js') diff --git a/src/ng/animator.js b/src/ng/animator.js index 2965717b..2b399813 100644 --- a/src/ng/animator.js +++ b/src/ng/animator.js @@ -395,11 +395,16 @@ var $AnimatorProvider = function() { } function insert(element, parent, after) { - if (after) { - after.after(element); - } else { - parent.append(element); - } + var afterNode = after && after[after.length - 1]; + var parentNode = parent && parent[0] || afterNode && afterNode.parentNode; + var afterNextSibling = afterNode && afterNode.nextSibling; + forEach(element, function(node) { + if (afterNextSibling) { + parentNode.insertBefore(node, afterNextSibling); + } else { + parentNode.appendChild(node); + } + }); } function remove(element) { -- cgit v1.2.3