Bug Tracker


Opened 6 years ago

Closed 6 years ago

#8923 closed bug (worksforme)

IE $.trim (non-breaking spaces)

Reported by: anonymous Owned by: anonymous
Priority: low Milestone: 1.next
Component: core Version: 1.5
Keywords: Cc:
Blocked by: Blocking:


$.trim in IE, do not remove "non-breaking spaces"

<span id="example">&nbsp;Hello <b>World</b> </span>

<script type="text/javascript">
	var text = $("#example").text();

	text = $.trim(text);


Output in IE: Hello World 12
Others browsers: Hello World 11

Change History (6)

comment:1 Changed 6 years ago by rwaldron

  • Component changed from unfiled to core
  • Priority changed from undecided to high
  • Status changed from new to open


comment:2 Changed 6 years ago by mikesherov

There exists a unit test for this, but it uses this:

	var nbsp = String.fromCharCode(160);

needless to say, IE must represent &nbsp; differently.

comment:3 Changed 6 years ago by mikesherov

I can't reproduce this in IE8. IE7?

comment:4 Changed 6 years ago by dmethvin

  • Owner set to anonymous
  • Status changed from open to pending

The assumption that leading/trailing spaces may be at fault may be incorrect. Can you create a test case that shows the actual text retrieved? This may be related to #3144 and not a problem with $.trim().

comment:5 Changed 6 years ago by dmethvin

  • Priority changed from high to low

comment:6 Changed 6 years ago by dmethvin

  • Resolution set to worksforme
  • Status changed from pending to closed

OK, this example is almost exactly what was reported, and it's working in IE6/7/8 for me:


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

Modify Ticket

Change Properties

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

Note: See TracTickets for help on using tickets.