Bug 130184

Summary: String.prototype.trim removes U+200B from strings.
Product: WebKit Reporter: Lasse R.H. Nielsen <lrn>
Component: JavaScriptCoreAssignee: Geoffrey Garen <ggaren>
Severity: Normal CC: ap, ggaren, m.goleb+bugzilla, oliver
Priority: P2    
Version: 525.x (Safari 3.2)   
Hardware: Unspecified   
OS: Unspecified   
Description Flags
Patch msaboff: review+

Description Lasse R.H. Nielsen 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.
Comment 1 Alexey Proskuryakov 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.
Comment 2 Geoffrey Garen 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.
Comment 3 Geoffrey Garen 2014-04-29 12:42:02 PDT
Created attachment 230402 [details]
Comment 4 Michael Saboff 2014-04-29 12:46:12 PDT
Comment on attachment 230402 [details]

Comment 5 Geoffrey Garen 2014-04-29 12:47:49 PDT
Committed r167951: <http://trac.webkit.org/changeset/167951>