Bug Tracker

Opened 10 years ago

Closed 9 years ago

#5784 closed bug (wontfix)

IE 6/7 clone tainting URLs

Reported by: georgem Owned by:
Priority: major Milestone:
Component: manipulation Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:

Description

This issue was discovered while using the jQuery ConvertTo plugin. http://plugins.jquery.com/project/convertTo

Looking closely at

var contents = $this.html();
var source = $("<div></div>").append($this.clone(true)).html().replace(contents, "");

Here is the contents of each variable

var contents

<DIV style="WIDTH: 313px; HEIGHT: 157px; OVERFLOW: hidden" id=cta_key_home_cta_1 class=cta wc:delay="5"><A href="/photos/"><IMG alt=home_cta_1 src="/media/ctas/home-cta1_.jpg"></A> 
<DIV class=cta_item hidden="true" wc:link="/photos/" wc:image="/media/ctas/home-cta1_.jpg" wc:swf=""></DIV>
<DIV class=cta_item hidden="true" wc:link="/photos/" wc:image="/media/ctas/home-cta2__.jpg" wc:swf=""></DIV>
<DIV class=cta_item hidden="true" wc:link="/photos/" wc:image="/media/ctas/home-cta3__.jpg" wc:swf=""></DIV></DIV>
<DIV style="WIDTH: 313px; HEIGHT: 157px; OVERFLOW: hidden" id=cta_key_home_cta_2 class=cta wc:delay="5"><A href="/locator/"><IMG alt=home_cta_2 src="/media/ctas/home-cta2_.jpg"></A> 
<DIV class=cta_item hidden="true" wc:link="/locator/" wc:image="/media/ctas/home-cta2_.jpg" wc:swf=""></DIV></DIV>
<DIV style="WIDTH: 313px; HEIGHT: 157px; OVERFLOW: hidden" id=cta_key_home_cta_3 class=cta wc:delay="5"><A href="/blog/"><IMG alt=home_cta_3 src="/media/ctas/home-cta3_.jpg"></A> 
<DIV class=cta_item hidden="true" wc:link="/blog/" wc:image="/media/ctas/home-cta3_.jpg" wc:swf=""></DIV></DIV>

var source

<DIV id=homectas class="container something" cellpadding="0" cellSpacing="0">
<DIV style="WIDTH: 313px; HEIGHT: 157px; OVERFLOW: hidden" id=cta_key_home_cta_1 class=cta wc:delay="5"><A href="http://192.168.1.176:8000/photos/"><IMG alt=home_cta_1 src="http://192.168.1.176:8000/media/ctas/home-cta1_.jpg"></A> 
<DIV class=cta_item hidden="true" wc:link="/photos/" wc:image="/media/ctas/home-cta1_.jpg" wc:swf=""></DIV>
<DIV class=cta_item hidden="true" wc:link="/photos/" wc:image="/media/ctas/home-cta2__.jpg" wc:swf=""></DIV>
<DIV class=cta_item hidden="true" wc:link="/photos/" wc:image="/media/ctas/home-cta3__.jpg" wc:swf=""></DIV></DIV>
<DIV style="WIDTH: 313px; HEIGHT: 157px; OVERFLOW: hidden" id=cta_key_home_cta_2 class=cta wc:delay="5"><A href="http://192.168.1.176:8000/locator/"><IMG alt=home_cta_2 src="http://192.168.1.176:8000/media/ctas/home-cta2_.jpg"></A> 
<DIV class=cta_item hidden="true" wc:link="/locator/" wc:image="/media/ctas/home-cta2_.jpg" wc:swf=""></DIV></DIV>
<DIV style="WIDTH: 313px; HEIGHT: 157px; OVERFLOW: hidden" id=cta_key_home_cta_3 class=cta wc:delay="5"><A href="http://192.168.1.176:8000/blog/"><IMG alt=home_cta_3 src="http://192.168.1.176:8000/media/ctas/home-cta3_.jpg"></A> 
<DIV class=cta_item hidden="true" wc:link="/blog/" wc:image="/media/ctas/home-cta3_.jpg" wc:swf=""></DIV></DIV></DIV>

Looking through the html you can see that all the src and href attributes have changed and now include the full URL. This then breaks the ability to replace not to mention returns unexpected results compared to every other browser.

Change History (3)

comment:1 Changed 10 years ago by georgem

var source (Expected result)

<DIV id=homectas class="container something" cellpadding="0" cellSpacing="0"></DIV>

comment:2 Changed 10 years ago by dmethvin

Unfortunately, IE expands the URL when it serializes HTML inside .clone(). This issue has been identified before and closed as wontfix because it doesn't have a reasonable solution.

http://github.com/jquery/jquery/blob/master/src/manipulation.js#L149

If you can think of a solution let us know.

comment:3 Changed 9 years ago by dmethvin

Component: unfiledmanipulation
Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.