#10926 closed bug (invalid)
Wrap function doesn't wrap jQuery objects unless added to DOM
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | manipulation | Version: | 1.6.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
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?
Thanks
Change History (2)
comment:1 Changed 11 years ago by
Component: | unfiled → manipulation |
---|---|
Priority: | undecided → low |
Resolution: | → invalid |
Status: | new → closed |
comment:2 Changed 11 years ago by
This is to confirm that given solution works for me. Thanks for the help.
Note: See
TracTickets for help on using
tickets.
Not a bug,
.wrap()
returns the original set. From the docs:For what you're trying to do, you'll need to add
.parent()
like this:$("<a>").wrap("<li>").parent().appendTo("body");