Bug Tracker

Modify

Ticket #5429 (closed bug: duplicate)

Opened 4 years ago

Last modified 4 years ago

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

Description

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"; alert(pretext); var text = jQuery("#someid").text(pretext).html(); alert(text);

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.

Change History

comment:1 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to duplicate

Duplicate of #3144.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.