Side navigation
#6212 closed bug (patchwelcome)
Opened March 03, 2010 03:51PM UTC
Closed November 19, 2010 03:49AM UTC
IE6 loads images twice when adding HTML snuippet with $.html() or $.load()
Reported by: | sanelson | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | |
Component: | manipulation | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I have an Ajax call that returns an HTML snippet containing <img> tags, among other things. The src of one of these images is actually a Java servlet, which returns an image when called. On IE6, this servlet gets called twice.
On line 4191 in jquery.js, it is doing a check to see if this snippet can be inserted with innerHTML. This check fails in IE6, but passes in Firefox and seems to pass in IE7+ (I'm having trouble debugging IE7+, so I can't say for sure, but the issue doesn't exist in IE8 running in compatibility mode). On IE6, jQuery goes on to use append() to add the HTML snippet, which calls clean().
In the clean method, on line 4447, it calls:
div.innerHTML = wrap[1] + elem + wrap[2];
This causes IE to load all the images, and call the servlet.
Then, on line 4477, it does this:
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
This again, causes IE to load all the images, and it calls the servlet again.
It seems the there are two issues here:
1) This should simply be getting loaded with innerHTML on IE6 just like every other browser.
2) When using append(), the images should not be loaded twice.
Attachments (2)
Change History (3)
Changed June 15, 2010 12:28AM UTC by comment:1
component: | unfiled → manipulation |
---|
Changed November 12, 2010 02:40AM UTC by comment:2
milestone: | 1.4.3 |
---|
Resetting milestone to future.
Changed November 19, 2010 03:49AM UTC by comment:3
priority: | → undecided |
---|---|
resolution: | → patchwelcome |
status: | new → closed |
Most things do not fall over when hit twice, and there are other corner-cases in IE6 that will cause duplicate loading of external resources as well that can’t be resolved. That said, please feel free to submit a patch that corrects this issue if you’ve got one, and we will consider it for inclusion.