Side navigation
#7723 closed bug (invalid)
Opened December 07, 2010 11:01PM UTC
Closed December 08, 2010 12:12AM UTC
Last modified March 14, 2012 08:36PM UTC
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: |
Description
$("<a>").text("hi\\nthere").html() properly returns in IE8 but not IE7. IE7 strips the newlines.
Attachments (0)
Change History (2)
Changed December 07, 2010 11:04PM UTC by comment:1
Changed December 08, 2010 12:12AM UTC by comment:2
_comment0: | Thanks for taking the time to contribute to the jQuery project by writing a bug report. \ \ The [http://api.jquery.com/html/ 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 isntead use `.text()` here anyway. → 1291767175103225 |
---|---|
resolution: | → invalid |
status: | new → closed |
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.
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.