This one was tricky because we've never explicitly said *not* to use
multiple elements in wrap, just that you should have one. There were two
options:
- Ignore the remaining elements (as you suggested) and possibly break some
unknown code.
- Create a new case where .pushStack is used, potentially breaking code
that depends on normal cases like .wrap("<p></p>") behaving.
It seemed like #2 was much more likely to cause problems so I opted for your
patch. Filed and fixed:
http://dev.jquery.com/ticket/4903
http://dev.jquery.com/changeset/6435
--John
On Tue, Jul 14, 2009 at 7:11 PM, David Flanagan <[email protected]>wrote:
>
> If I do this:
>
> $("h1").wrap("<i></i><i></i>")
>
> Then I get two copies of each of the h1 tags. The return value of the
> wrap() method does not include the extra copies, however. Is this a bug?
>
> If so, maybe change this line in wrapAll:
>
> var wrap = jQuery( html, this[0].ownerDocument).clone();
>
> To this:
>
> var wrap = jQuery( html, this[0].ownerDocument).eq(0).clone();
>
> David
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---