jquery/jquery — pull request #896 by wwalser (2012-08-16 06:32:44+00:00)
Title: Make jQuery.trim consistent with ECMAScript 5 String.prototype.trim cross browser.

This adds 41 bytes when gzipped.

There is also a bit of history around the trim function and the way it's done. Most recently https://github.com/jquery/jquery/commit/26bdbb806eeb1d8e1881b3fc11ff298eb4d1dca0 and back in 1.4.3 there was this http://forum.jquery.com/topic/faster-jquery-trim#14737000000647377.

See http://jsfiddle.net/MHzar/1/ in Chrome or Firefox then in IE8 for a difference.

----
Section 15.5.4.20 of ECMAScript 5 standard, definition of String.prototype.trim()
15.5.4.20 String.prototype.trim ( )
…
3. Let T be a String value that is a copy of S with both leading and trailing white space removed. The definition
of white space is the union of WhiteSpace and LineTerminator.

Section 7.2 defines White Space as
```
Code Unit Value
\u0009 - Tab -
\u000B - Vertical Tab -
\u000C - Form Feed -
\u0020 - Space -

\u00A0 - No-break space -
\uFEFF - Byte Order Mark -
Other category (Zs) - Any other Unicode "space separator" -
```
Note the bit about "Any other Unicode 'space separator'".
Unicode Zs or Space Separators (http://www.fileformat.info/info/unicode/category/Zs/list.htm)
\uFEFF
\u1680
\u180E
\u2000-\u200A
\u202F
\u205F
\u3000