Skip to main content

Bug Tracker

Side navigation

#10913 closed bug (invalid)

Opened November 29, 2011 08:41AM UTC

Closed November 29, 2011 11:50AM UTC

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:
Blocked by: Blocking:

1. Set html value with double spaces:

$("#list").html('<li>List item with double spaces.</li>');

2. Get html value:


3. 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:

Attachments (0)
Change History (1)

Changed November 29, 2011 11:50AM UTC by sindresorhus comment:1

component: unfiledmanipulation
priority: undecidedlow
resolution: → invalid
status: newclosed

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