Use javascript trim() when available

Instead of always using a regex replace, it will use the native trim
function when available. This results in increased performance on every
system with trim() implemented (Firefox 3, Opera 11, Safari 5.x, Chrome
10, Internet Explorer 9 in standards mode).

Benchmarks: http://jsperf.com/wds1/10
Merge pull request #4 from epmatsw/master

Use native javascript trim() when available