#7303 closed bug (invalid)
Regression: Cannot use appendTo() with a jQuery object that holds many elements
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | 1.5 |
Component: | unfiled | Version: | 1.4.3 |
Keywords: | appendto object | Cc: | |
Blocked by: | Blocking: |
Description
I have a jQuery object to which I push two elements. Then I use .appendTo() to append these elements into another element. This works in 1.4.2 but not in 1.4.3.
Here's an example:
<!doctype html> <html> <head> <title>jQuery test</title> <!-- use 1.4.2 if you want to see it work --> <script src="http://code.jquery.com/jquery-1.4.3.min.js"></script> </head> <body> <div id="target"></span> <script> (function() { var container = $(); container.push($('<span>foo</span>')); container.push($('<span>bar</span>')); container.appendTo($('#target')) })(); </script> </body> </html>
Change History (6)
comment:1 Changed 12 years ago by
comment:3 Changed 12 years ago by
Keywords: | appendto object added |
---|---|
Priority: | undecided → low |
Status: | new → open |
There are much simpler ways this problem could be coded, but I've tested your original code out in 1.4.3 (and our latest version from Git) and it does indeed appear to be broken with both. Opening as a valid ticket and flagging for further review.
comment:4 Changed 12 years ago by
Keywords: | needsreview added |
---|
comment:5 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | open → closed |
A jQuery object should contain an array of DOM elements, not other jQuery objects. Also, there has never been a documented method .push
on a jQuery object.
comment:6 Changed 12 years ago by
Keywords: | needsreview removed |
---|
Note: See
TracTickets for help on using
tickets.
Sorry about pasting code to the ticket. This is my first ticket and I only found out after posting that jsFiddle is preferred.