Skip to main content

Bug Tracker

Side navigation

#5429 closed bug (duplicate)

Opened October 30, 2009 10:00PM UTC

Closed October 31, 2009 12:25AM UTC

.text() and .html() are mangling values in incorrect ways in Internet Explorer

Reported by: greg.hellings Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: IE Cc:
Blocked by: Blocking:

In an effort to clean up strings of characters which might contain HTML entity characters, I am running the strings through jQuery's .text() and .html() methods. However, doing so mangles newline characters in the text in IE. The following is a test case:

var pretext = "\\r\\nLine 1\\r\\n\\r\\nLine2\\r\\n\\r\\n--- Line 3 ---\\r\\n\\r\\nLine 4\\r\\n";


var text = jQuery("#someid").text(pretext).html();


In Firefox and Chrome, the strings pretext and text display identically. In Internet Explorer, text displays with no new line characters. I have been unable to verify whether this is a different behavior of IE versus the other browsers or whether this is a jQuery quirk.

Attachments (0)
Change History (1)

Changed October 31, 2009 12:25AM UTC by dmethvin comment:1

resolution: → duplicate
status: newclosed

Duplicate of #3144.