Skip to content

Commit

Permalink
don't nest parent in child Sortable
Browse files Browse the repository at this point in the history
when nesting Sortable's, we're not interested in this error:
"HierarchyRequestError: Failed to execute 'appendChild' on 'Node': The new child element contains the parent."
  • Loading branch information
depoulo committed Aug 21, 2015
1 parent a42d0bb commit e51dc53
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,9 @@
_cloneHide(isOwner);

if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect) !== false) {
el.appendChild(dragEl);
if (!dragEl.contains(el)) {
el.appendChild(dragEl);
}
this._animate(dragRect, dragEl);
target && this._animate(targetRect, target);
}
Expand Down Expand Up @@ -644,10 +646,12 @@
after = (nextSibling !== dragEl) && !isLong || halfway && isLong;
}

if (after && !nextSibling) {
el.appendChild(dragEl);
} else {
target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
if (!dragEl.contains(el)) {
if (after && !nextSibling) {
el.appendChild(dragEl);
} else {
target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
}
}

this._animate(dragRect, dragEl);
Expand Down
Loading

0 comments on commit e51dc53

Please sign in to comment.