#6455 closed bug (fixed)
Strange behaviour of jQuery(elementArray)
Reported by: | tomtom | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.4.3 |
Component: | manipulation | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I just tried to migrate my Project from 1.3.2 to 1.4.2 and found a bug in the new version. I've got an array of pure DOM Elements that all have to be appended to another element at once. But since 1.4.2 only the first element of the array gets appended. The strange thing is, that when I debug the code using firebug, all elements get appended so I presume there is a race condition somewhere. I reproduced the bug using the following code:
<html> <head> <script src='http://code.jquery.com/jquery-1.4.2.min.js'></script> <script> $(document).ready(function() { var test=[]; for (var i=0; i<10;i++) { test.push($("<li>test"+i+"</li>")[0]); } $(test).appendTo($('#list')); }); </script> </head> <body> <ul id='list'></ul> </body> </html>
I found a workaround for the meantime. Before calling $(test).appendTo($('#list'));
I convert all array elements to jQuery objects:
for (i=0; i<test.length; i++) { test[i] = $(test[i]); } $(test).appendTo($('#list'));
Tested with Firefox 3.6.3 and Chrome 5.
Attachments (1)
Change History (5)
Changed 13 years ago by
Attachment: | test-6455.html added |
---|
comment:3 Changed 13 years ago by
Priority: | → undecided |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Ran test case with 1.4.3 - issue no longer occurs.
comment:4 Changed 13 years ago by
Priority: | undecided → low |
---|
Test case