Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#10926 closed bug (invalid)

Wrap function doesn't wrap jQuery objects unless added to DOM

Reported by: [email protected] Owned by:
Priority: low Milestone: None
Component: manipulation Version: 1.6.4
Keywords: Cc:
Blocked by: Blocking:


Hi there,

It seems there is a dependency in wrap function which works correctly only if selector points to existing DOM element and doesn't produce anything if selector is a jQuery object which is not yet added to DOM. jsFiddle share (http://jsfiddle.net/SSujs/) describes my problem better.

I hope team can advice why it so and is there someway around this. Couldn't it just work without element added to DOM?


Change History (2)

comment:1 Changed 11 years ago by sindresorhus

Component: unfiledmanipulation
Priority: undecidedlow
Resolution: invalid
Status: newclosed

Not a bug, .wrap()returns the original set. From the docs:

This method returns the original set of elements for chaining purposes.

For what you're trying to do, you'll need to add .parent() like this:

comment:2 Changed 11 years ago by [email protected]

This is to confirm that given solution works for me. Thanks for the help.

Note: See TracTickets for help on using tickets.