#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: |
Description
$("<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
comment:2 Changed 12 years ago by
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.
Note: See
TracTickets for help on using
tickets.
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.