Bug Tracker

Opened 15 years ago

Closed 15 years ago

Last modified 10 years ago

#1029 closed bug (wontfix)

$().html() serializes href attribute in IE — at Version 2

Reported by: brandon Owned by:
Priority: major Milestone: 1.1.3
Component: core Version: 1.1.2
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by brandon)

Take the following text (snippet): <a href="/?q=node/1" rel="bookmark" title="Permanent Link to windows">

Load into an existing DOM using the following (val.primarylinks contains the above text): $("#primarylinks").hide().html(val.primarylinks).show();

The text is changed to: <a href="http://www.mydomain.com/?q=node/1" rel="bookmark" title="Permanent Link to windows">

As you can see, the href is being changed into an absolute path. I attempted to debug the script in vs2005 and it appears that the text actually changes during the "clean" function at this line: div.innerHTML = wrap[1] + s + wrap[2];

I'm no expert but it seems the assignment to innerHTML does some processing??? Assigning to innerText does not alter the string.

Change History (2)

comment:1 Changed 15 years ago by brandon

From Fil on Dev list:

I had a similar problem with an <a href="~fil/..."> being transformed into <a href="%7Efil/..."> with the .html() method under FF (consequences were that the cookies were not transmitted, so the "action" was not "authorised"). This did not happen with .clone(), but .clone() was crashing Safari.

So finally I resorted to: jQuery.fn.clone2 = jQuery.browser.safari ? jQuery.fn.html : jQuery.fn.clone;

(under jquery 1.1.1 release 2); see http://trac.rezo.net/trac/spip/changeset/8786/spip/dist/javascript/async_upload.js

comment:2 Changed 15 years ago by brandon

Description: modified (diff)
need: Review
Resolution: wontfix
Status: newclosed

IE serializes href and src attributes when using innerHTML ... thats it.

Note: See TracTickets for help on using tickets.