Fix ie8 bug

String.trim() is not supported in ie8, replaced with String.replace(/^\s+|\s+$/g, '')
Merge pull request #124 from masix/master

Fix ie8 bug. Thanks masix!