Skip to content
Browse files

Issue 103 - insertAfter() and after() throw exception

  • Loading branch information...
1 parent 27f4da6 commit f04c63ac749c2c9b883b8aa3884adc4e35f40fed @ilinsky ilinsky committed Nov 6, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 ample/runtime/modules/manipulation.js
View
4 ample/runtime/modules/manipulation.js
@@ -163,7 +163,7 @@ cQuery.prototype.insertAfter = function(vArgument1) {
fQuery_each(oSelf, function() {
var oNode = nIndex ? fNode_cloneNode(this, true) : this;
if (oBefore)
- fElement_insertBefore(oParent, oNode, oBefore);
+ fElement_insertBefore(oParent, oNode, oBefore == this ? oBefore.nextSibling : oBefore);
else
fElement_appendChild(oParent, oNode);
oQuery[oQuery.length++] = oNode;
@@ -299,7 +299,7 @@ cQuery.prototype.after = function(vArgument1) {
var oNode = nIndex ? fNode_cloneNode(this, true) : this;
if (oParent) {
if (oBefore)
- fElement_insertBefore(oParent, oNode, oBefore);
+ fElement_insertBefore(oParent, oNode, oBefore == this ? oBefore.nextSibling : oBefore);
else
fElement_appendChild(oParent, oNode);
}

0 comments on commit f04c63a

Please sign in to comment.
Something went wrong with that request. Please try again.