Bug Tracker

Opened 13 years ago

Closed 12 years ago

#6212 closed bug (patchwelcome)

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:


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)

ajax-calls.js (636 bytes) - added by sanelson 13 years ago.
Ajax calls
ajax-response.html (5.6 KB) - added by sanelson 13 years ago.
Ajax response

Download all attachments as: .zip

Change History (5)

Changed 13 years ago by sanelson

Attachment: ajax-calls.js added

Ajax calls

Changed 13 years ago by sanelson

Attachment: ajax-response.html added

Ajax response

comment:1 Changed 13 years ago by dmethvin

Component: unfiledmanipulation

comment:2 Changed 12 years ago by snover

Milestone: 1.4.3

Resetting milestone to future.

comment:3 Changed 12 years ago by snover

Priority: undecided
Resolution: patchwelcome
Status: newclosed

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.

Note: See TracTickets for help on using tickets.