From c2e45c769ef7a45f2bd14870236fd8e8bed38246 Mon Sep 17 00:00:00 2001 From: sunnylost Date: Mon, 14 Oct 2013 15:03:11 +0800 Subject: refactor(angular.js): improve trim performance According to Flagrant Badassery's blog http://blog.stevenlevithan.com/archives/faster-trim-javascript and this comparison http://jsperf.com/trim-function, this trim method is faster. Closes #4406 --- src/Angular.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Angular.js') diff --git a/src/Angular.js b/src/Angular.js index 11222118..f4f83d55 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -544,7 +544,7 @@ var trim = (function() { // TODO: we should move this into IE/ES5 polyfill if (!String.prototype.trim) { return function(value) { - return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value; + return isString(value) ? value.replace(/^\s\s*/, '').replace(/\s\s*$/, '') : value; }; } return function(value) { -- cgit v1.2.3