Skip to main content

Bug Tracker

Side navigation

#11608 closed bug (invalid)

Opened April 19, 2012 10:04PM UTC

Closed April 19, 2012 10:05PM UTC

Last modified April 19, 2012 10:37PM UTC

Trim Function Not Working in IE

Reported by: anonymous Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

The trim function does not work correctly in IE 9.0.8112.16421. Please look in to this, there is nothing complicated. Just run the following code:

var myVar = 'AB012';

alert(myVar);

myVar.trim(); // code breaks here in IE

alert(myVar);

Attachments (0)
Change History (7)

Changed April 19, 2012 10:05PM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

jQuery doesn't pollute the String object with a .trim() method. Please ask for help on a forum.

Changed April 19, 2012 10:11PM UTC by dmethvin comment:2

#11609 is a duplicate of this ticket.

Changed April 19, 2012 10:21PM UTC by anonymous comment:3

Replying to [comment:1 dmethvin]:

jQuery doesn't pollute the String object with a .trim() method. Please ask for help on a forum.

My code works fine in the following browsers: firefox, chrome, opera and safari. But breaks on the line that has myVar.trim() in internet explorer. Please explain to me how that is not a problem with the '.trim()' method?

Changed April 19, 2012 10:23PM UTC by dmethvin comment:4

We don't add a .trim() method to the String object. If you think you have found a bug in the IE9 String object, please file a bug with Microsoft. Or, ask for help on a forum.

Changed April 19, 2012 10:25PM UTC by mikesherov comment:5

Because

<String>.trim()
has nothing to do with jQuery.

$.trim(<String>)
does, and it works awesomely in all browsers.

Changed April 19, 2012 10:35PM UTC by anonymous comment:6

Replying to [comment:5 mikesherov]:

Because
<String>.trim()
has nothing to do with jQuery.
$.trim(<String>)
does, and it works awesomely in all browsers.

OK. Thank you guys. I will report to microsoft about the string. I find it interesting that the other browsers worked fine on this but explorer gave me problems. mikesherov thank you for the explaining, I changed my code & explorer is working nicely.

Changed April 19, 2012 10:37PM UTC by rwaldron comment:7

Replying to [comment:6 anonymous]:

Replying to [comment:5 mikesherov]: > Because
<String>.trim()
has nothing to do with jQuery. > >
$.trim(<String>)
does, and it works awesomely in all browsers. OK. Thank you guys. I will report to microsoft about the string. I find it interesting that the other browsers worked fine on this but explorer gave me problems. mikesherov thank you for the explaining, I changed my code & explorer is working nicely.

There is nothing surprising about this - IE has historically been broken, missing features and implementations.