Side navigation
#9588 closed bug (invalid)
Opened June 15, 2011 07:33AM UTC
Closed June 30, 2011 07:48AM UTC
appendTo behaves differently from append
Reported by: | martijn.vanderlee@crmmailtech.nl | Owned by: | martijn.vanderlee@crmmailtech.nl |
---|---|---|---|
Priority: | undecided | Milestone: | 1.next |
Component: | manipulation | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I had a situation where HTML was rendered by jQuery.
To explain, we have 2 files.
A is loaded normally and contains all javascript functions that render the HTML and load B through AJAX.
B contains static HTML including an element with id "imagesList" and a script which calles the rendering functions in A.
A then appends the HTML of B to the page and the function calls in B call functions in A which try to append HTML to the newly included HTML element in B;
$(html).appendTo('#imagesList');
This worked fine in JQuery 1.3.2 but since then we've upgraded to 1.6.1 in which it no longer rendered anything (according to Chrome inspector).
With 1.6.1 the following DID work however:
$('#imagesList').append(html);
According to the JQuery documentation, there should be no difference between the two statements, but there is.
It almost seems like the appendTo('#imagesList') selector is evaluated at load-time (in this case, before the element is in DOM) and $('#imagesList') is evaluated at run-time. But this is just uneducated speculation.
Confirmed in Chrome 12, FireFox 3, Safari and MSIE 8 and 9.
Attachments (0)
Change History (2)
Changed June 15, 2011 02:31PM UTC by comment:1
component: | unfiled → manipulation |
---|---|
owner: | → martijn.vanderlee@crmmailtech.nl |
status: | new → pending |
Changed June 30, 2011 07:48AM UTC by comment:2
resolution: | → invalid |
---|---|
status: | pending → closed |
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket!
Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, I've created this boilerplate: http://jsfiddle.net/rwaldron/da3nM/ Open the link and click to "Fork" in the top menu.