Skip to main content

Bug Tracker

Side navigation

#3713 closed enhancement (fixed)

Opened December 13, 2008 03:24PM UTC

Closed February 18, 2009 04:25PM UTC

DOM manipulations on elements not in the DOM

Reported by: scottgonzalez Owned by: john
Priority: major Milestone: 1.3
Component: core Version: 1.2.6
Keywords: Cc: john
Blocked by: Blocking:
Description

The following works:

$('<div></div>').wrap('<div></div>');

The following fails:

$('<div></div>').appendTo('body').remove().wrap('<div></div>');

The former works because jQuery.clean wraps the created elements in a div, but the div is never removed. Wrap, insertBefore, etc. should probably be updated to work on elements not in the DOM.

If you think it's necessary, you might want to create another ticket to have jQuery.clean remove the extra wrappers it creates.

Attachments (0)
Change History (3)

Changed December 13, 2008 03:27PM UTC by john comment:1

cc: → john
owner: → john

Now it seems like this should be pretty easy. When doing the wrapping just skip the "append to parentNode" step. The element will still be disconnected from the DOM - but that's ok since that's what the intent was.

Changed January 31, 2009 04:47PM UTC by dmethvin comment:2

See also #3940 .

Changed February 18, 2009 04:25PM UTC by john comment:3

resolution: → fixed
status: newclosed

This was fixed in 1.3, actually.