Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5349b20 commit 22b9b47Copy full SHA for 22b9b47
src/Angular.js
@@ -436,9 +436,20 @@ function isBoolean(value) {
436
}
437
438
439
-function trim(value) {
440
- return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value;
441
-}
+var trim = (function() {
+ // native trim is way faster: http://jsperf.com/angular-trim-test
+ // but IE doesn't have it... :-(
442
+ // TODO: we should move this into IE/ES5 polyfill
443
+ if (!String.prototype.trim) {
444
+ return function(value) {
445
+ return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value;
446
+ };
447
+ }
448
449
+ return isString(value) ? value.trim() : value;
450
451
+})();
452
+
453
454
/**
455
* @ngdoc function
0 commit comments