IE6 loads images twice when adding HTML snuippet with $.html() or $.load()
|Reported by:||sanelson||Owned by:|
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:
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) ), 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.