RESOLVED FIXED 130184
String.prototype.trim removes U+200B from strings.
https://bugs.webkit.org/show_bug.cgi?id=130184
Summary String.prototype.trim removes U+200B from strings.
Lasse R.H. Nielsen
Reported 2014-03-13 02:58:48 PDT
In the current version of Safari on a Mac, the String.prototype.trim function removes "\u200b" characters from the string. That character is not recognized as whitespace by the ECMAScript 5 spec (or the ES6 drafts), and should not be removed. Example code: alert("\u200b".trim().length); // should alert 1, actually alerts 0. Apologies if this has been fixed in a nightly build.
Attachments
Patch (4.55 KB, patch)
2014-04-29 12:42 PDT, Geoffrey Garen
msaboff: review+
Alexey Proskuryakov
Comment 1 2014-04-29 12:17:12 PDT
Adding this character was intentional, see discussion in bug 26590. Seems like maybe we should remove it now to match the new standard.
Geoffrey Garen
Comment 2 2014-04-29 12:30:40 PDT
Looks like bug 26590 was written to match a draft specification, but no ratified specification ever included u200b, Unicode does not include u200b in the 'Separator, Space' category, and Firefox does not include it either.
Geoffrey Garen
Comment 3 2014-04-29 12:42:02 PDT
Michael Saboff
Comment 4 2014-04-29 12:46:12 PDT
Comment on attachment 230402 [details] Patch r=me
Geoffrey Garen
Comment 5 2014-04-29 12:47:49 PDT
Note You need to log in before you can comment on or make changes to this bug.