Modify ↓
Ticket #10913 (closed bug: invalid)
jQuery.html() - removes double spaces on IE7 and IE8
| Reported by: | Agnius101 | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | manipulation | Version: | 1.7.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
- Set html value with double spaces:
$("#list").html('<li>List item with double spaces.</li>');
- Get html value:
$("#list").html();
- html() function returns value without double spaces on IE7 and IE8, while it returns expected value on IE9, FF and Chrome.
See example on and check console output: http://jsfiddle.net/L6zq6/1/
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

This is not a jQuery issue. Using alert( document.getElementById("list").innerHTML ); alerts the same thing on IE7/8
You could of course use <pre> or CSS white-space: pre to keep the whitespace. You could also replace the whitespace with the whitespace entitity