Opened 14 years ago
Closed 14 years ago
#3790 closed bug (invalid)
after does not always removes the argument from its original position in the Dom, as JavaScript's insertBefore does.
Reported by: | ericvandervelden | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.3 |
Component: | core | Version: | 1.2.6 |
Keywords: | insertBefore | Cc: | |
Blocked by: | Blocking: |
Description
JavaScript's insertBefore removes the element which it inserts from its original position in the DOM. Now for example $('p').after(elem) clones elem when the list $('p') has length>1. This happens in jQuery.fn.domManip. Probably because insertBefore will be called more then once. But finally elem will not be removed from its original position in the DOM, because it itself is not a argument of insertBefore, its clones are . When the list $('p') has length=1, it is removed, because is is itself the argument of insertBefore. Probably elem should always be removed from its original position in the DOM by after (and before, ...)
See this thread:
http://groups.google.com/group/jquery-en/browse_frm/thread/498c95e920a0c3d?q=#85833f44e69e8c6c