Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#7723 closed bug (invalid)

HTML escaping broken for newlines in IE7

Reported by: dlee Owned by:
Priority: undecided Milestone: 1.6
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:


$("<a>").text("hi\nthere").html() properly returns in IE8 but not IE7. IE7 strips the newlines.

Change History (2)

comment:1 Changed 12 years ago by dlee

Actually, it's a problem with IE8 as well. Webkit and Firefox work properly. IE also works if you use a <pre> element instead of an <a> element.

comment:2 Changed 12 years ago by jitter

Resolution: invalid
Status: newclosed

Thanks for taking the time to contribute to the jQuery project by writing a bug report.

The documentation states:

This method uses the browser's innerHTML property. Some browsers may not return HTML that exactly replicates the HTML source in an original document.

So this is a problem of IE's innerHTML implementation. You should instead use .text() here anyway.

Last edited 12 years ago by jitter (previous) (diff)
Note: See TracTickets for help on using tickets.