Skip to main content

Bug Tracker

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 timmywil comment:1

resolution: → duplicate
status: newclosed

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.

Changed April 04, 2011 02:32PM UTC by timmywil comment:2

Duplicate of #7369.

Changed June 08, 2011 08:57PM UTC by Jonas Lundgren comment:3

This is still broken in 1.6.1

Changed June 08, 2011 10:00PM UTC by timmywil comment:4

component: unfiledmanipulation
priority: undecidedlow
resolution: duplicate
status: closedreopened

Thanks. Meant to reopen this one.

Changed June 08, 2011 10:00PM UTC by timmywil comment:5

status: reopenedopen

Changed June 08, 2011 10:00PM UTC by timmywil comment:6

Changed July 12, 2011 07:41PM UTC by john 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 antishok 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 dmethvin comment:9

resolution: → duplicate
status: openclosed

Agreed.

Changed July 12, 2012 02:21AM UTC by dmethvin comment:10

Duplicate of #10517.

Changed February 17, 2014 07:04PM UTC by leomontenegro6@gmail.com 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().