Side navigation
#8759 closed bug (duplicate)
Opened April 04, 2011 08:26AM UTC
Closed July 12, 2012 02:21AM UTC
Last modified February 17, 2014 07:04PM UTC
.after() breaks on disconnected DOM node with content
Reported by: | Jack <juichenieder-jq@yahoo.co.uk> | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | manipulation | Version: | 1.5.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Ok, quick description.
This works as expected (it returns a set of 2 dom nodes):\\\\
$('<div></div>').after('<p></p>')
This does not work (it returns only the first of the 2 dom nodes):\\\\
$('<div>f</div>').after('<p></p>')
Attachments (0)
Change History (11)
Changed April 04, 2011 02:32PM UTC by comment:1
resolution: | → duplicate |
---|---|
status: | new → closed |
Changed June 08, 2011 08:57PM UTC by comment:3
This is still broken in 1.6.1
Changed June 08, 2011 10:00PM UTC by comment:4
component: | unfiled → manipulation |
---|---|
priority: | undecided → low |
resolution: | duplicate |
status: | closed → reopened |
Thanks. Meant to reopen this one.
Changed June 08, 2011 10:00PM UTC by comment:5
status: | reopened → open |
---|
Changed June 08, 2011 10:00PM UTC by comment:6
Changed July 12, 2011 07:41PM UTC by comment:7
I think we just need to make sure that the parentNode isn't a document fragment. Confirmed in triage.
Changed July 11, 2012 10:45PM UTC by comment:8
I think #10517 is a dupe of this one, and it was fixed in the latest 1.8b2
Changed July 12, 2012 02:21AM UTC by comment:9
resolution: | → duplicate |
---|---|
status: | open → closed |
Agreed.
Changed July 12, 2012 02:21AM UTC by comment:10
Duplicate of #10517.
Changed February 17, 2014 07:04PM UTC by comment:11
Strangely, I'm getting the same issue after updating jQuery from 1.8.2 to 1.11.0. The $.after() and $.before() methods aren't working on newly created elements. I need to firstly add the newly created element to DOM, and then insert the new content to it. Dunno if it's a bug, of if these methods were changed.
Anyway, a workaround for this is using $.add() method, but it will work only as a alternative to $.after() method, not $.before().
We fixed this issue in closest for 1.6, but there is probably an underlying issue we should take a closer look at. Closing as duplicate.