Side navigation
#10926 closed bug (invalid)
Opened November 30, 2011 09:56AM UTC
Closed November 30, 2011 01:39PM UTC
Last modified November 30, 2011 02:24PM UTC
Wrap function doesn't wrap jQuery objects unless added to DOM
Reported by: | wassimahmed@gmail.com | 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
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");