Skip to content

Commit 4512612

Browse files
author
Cecil Worsley
committed
Adding trim function check for IE8 support
1 parent 0711c00 commit 4512612

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

app/js/timer.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ angular.module('timer', [])
1212
},
1313
controller: ['$scope', '$element', '$attrs', '$timeout', function ($scope, $element, $attrs, $timeout) {
1414

15+
// Checking for trim function since IE8 doesn't have it
16+
// If not a function, create tirm with RegEx to mimic native trim
17+
if(typeof String.prototype.trim !== 'function') {
18+
String.prototype.trim = function() {
19+
return this.replace(/^\s+|\s+$/g, '');
20+
}
21+
}
22+
1523
//angular 1.2 doesn't support attributes ending in "-start", so we're
1624
//supporting both "autostart" and "auto-start" as a solution for
1725
//backward and forward compatibility.

0 commit comments

Comments
 (0)