Bug Tracker

Modify

Ticket #8923 (closed bug: worksforme)

Opened 3 years ago

Last modified 3 years ago

IE $.trim (non-breaking spaces)

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

Description

$.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);

	document.write(text.length);
</script>

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

Change History

comment:1 Changed 3 years ago by rwaldron

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

Confirmed

comment:2 Changed 3 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 3 years ago by mikesherov

I can't reproduce this in IE8. IE7?

comment:4 Changed 3 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 3 years ago by dmethvin

  • Priority changed from high to low

comment:6 Changed 3 years ago by dmethvin

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

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

 http://jsfiddle.net/dmethvin/ZmYCL/

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.