mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-15 22:34:17 +08:00
refactor: simplify trim fn now that IE9 has String#trim
This commit is contained in:
@@ -575,19 +575,9 @@ function isPromiseLike(obj) {
|
||||
}
|
||||
|
||||
|
||||
var trim = (function() {
|
||||
// native trim is way faster: http://jsperf.com/angular-trim-test
|
||||
// but IE doesn't have it... :-(
|
||||
// TODO: we should move this into IE/ES5 polyfill
|
||||
if (!String.prototype.trim) {
|
||||
return function(value) {
|
||||
return isString(value) ? value.replace(/^\s\s*/, '').replace(/\s\s*$/, '') : value;
|
||||
};
|
||||
}
|
||||
return function(value) {
|
||||
return isString(value) ? value.trim() : value;
|
||||
};
|
||||
})();
|
||||
var trim = function(value) {
|
||||
return isString(value) ? value.trim() : value;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user