Bug Tracker

Opened 9 years ago

Closed 9 years ago

#8937 closed bug (invalid)

wrapAll() Doesn't Expose Wrapper

Reported by: matthew@… Owned by: matthew@…
Priority: low Milestone: 1.next
Component: manipulation Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:

Description

After using wrapAll() to create a wrapper, there's no way to get a reference to that wrapper (without reselecting, e.g. with an id).

var wrapper = $('<div />');
$('.some-consecutive-elements').wrapAll(wrapper);
wrapper.append('<span>Some new text</span>'); // Will not work because the "wrapper" variable is not actually a reference to the wrapping element. You must perform a new selection to get the wrapping element.

Change History (2)

comment:1 Changed 9 years ago by timmywil

Component: unfiledmanipulation
Owner: set to matthew@…
Priority: undecidedlow
Status: newpending
Type: enhancementbug

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced test case on http://jsFiddle.net that reproduces the issue experienced to help us assess your ticket. Additionally, test against the jQuery (edge) version to ensure the issue still exists.

comment:2 Changed 9 years ago by dmethvin

Resolution: invalid
Status: pendingclosed

That's the way the API is documented to work. Just like .clone() selects the clones, not the original elements.

Note: See TracTickets for help on using tickets.