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:

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 (6)

comment:1 Changed 6 years ago by Rick Waldron

Component: unfiledcore
Priority: undecidedhigh
Status: newopen

Confirmed

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: openpending

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: highlow

comment:6 Changed 6 years ago by dmethvin

Resolution: worksforme
Status: pendingclosed

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

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

Note: See TracTickets for help on using tickets.