Skip to main content

Bug Tracker

Side navigation

#8923 closed bug (worksforme)

Opened April 20, 2011 07:03AM UTC

Closed June 11, 2011 08:00PM UTC

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"> 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

Attachments (0)
Change History (6)

Changed April 27, 2011 02:28AM UTC by rwaldron comment:1

component: unfiledcore
priority: undecidedhigh
status: newopen

Confirmed

Changed June 09, 2011 11:22PM UTC by mikesherov comment:2

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

	var nbsp = String.fromCharCode(160);

needless to say, IE must represent   differently.

Changed June 09, 2011 11:35PM UTC by mikesherov comment:3

I can't reproduce this in IE8. IE7?

Changed June 11, 2011 07:45PM UTC by dmethvin comment:4

owner: → 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().

Changed June 11, 2011 07:45PM UTC by dmethvin comment:5

priority: highlow

Changed June 11, 2011 08:00PM UTC by dmethvin comment:6

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/