Ticket #11608 (closed bug: invalid)
Trim Function Not Working in IE
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | None |
| Component: | unfiled | Version: | 1.7.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
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);
Change History
comment:1 follow-up: ↓ 3 Changed 13 months ago by dmethvin
- Status changed from new to closed
- Resolution set to invalid
comment:3 in reply to: ↑ 1 Changed 13 months ago by anonymous
Replying to 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?
comment:4 Changed 13 months ago by dmethvin
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.
comment:5 follow-up: ↓ 6 Changed 13 months ago by mikesherov
Because <String>.trim() has nothing to do with jQuery.
$.trim(<String>) does, and it works awesomely in all browsers.
comment:6 in reply to: ↑ 5 ; follow-up: ↓ 7 Changed 13 months ago by anonymous
Replying to 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.
comment:7 in reply to: ↑ 6 Changed 13 months ago by rwaldron
Replying to anonymous:
Replying to 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.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

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