From 4c6d26a38f977f61d4deaacfd6b6c71f331e8065 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Sun, 17 Jul 2011 00:47:11 -0700 Subject: fix(strict mode): fix all issues discovered by strict mode and unit/e2e tests --- src/Angular.js | 2 +- src/angular-mocks.js | 5 +++-- src/filters.js | 2 +- src/parser.js | 2 -- 4 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Angular.js b/src/Angular.js index f28789d5..295be998 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -115,7 +115,7 @@ var _undefined = undefined, angularCallbacks = extensionMap(angular, 'callbacks'), nodeName_, rngScript = /^(|.*\/)angular(-.*?)?(\.min)?.js(\?[^#]*)?(#(.*))?$/, - uid = ['0', '0', '0']; + uid = ['0', '0', '0'], DATE_ISOSTRING_LN = 24; /** diff --git a/src/angular-mocks.js b/src/angular-mocks.js index 9154f8b5..2590c122 100644 --- a/src/angular-mocks.js +++ b/src/angular-mocks.js @@ -523,7 +523,8 @@ function TzDate(offset, timestamp) { }; //hide all methods not implemented in this mock that the Date prototype exposes - var unimplementedMethods = ['getMilliseconds', 'getTime', 'getUTCDay', + var self = this, + unimplementedMethods = ['getMilliseconds', 'getUTCDay', 'getUTCMilliseconds', 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', @@ -531,7 +532,7 @@ function TzDate(offset, timestamp) { 'toLocaleTimeString', 'toSource', 'toString', 'toTimeString', 'toUTCString', 'valueOf']; angular.forEach(unimplementedMethods, function(methodName) { - this[methodName] = function() { + self[methodName] = function() { throw { name: "MethodNotImplemented", message: "Method '" + methodName + "' is not implemented in the TzDate mock" diff --git a/src/filters.js b/src/filters.js index 491bb88e..f2cff14d 100644 --- a/src/filters.js +++ b/src/filters.js @@ -114,7 +114,7 @@ angularFilter.number = function(number, fractionSize){ pow = Math.pow(10, fractionSize), whole = '' + number, formatedText = '', - i; + i, fraction; if (whole.indexOf('e') > -1) return whole; diff --git a/src/parser.js b/src/parser.js index 0c4a391a..541addc4 100644 --- a/src/parser.js +++ b/src/parser.js @@ -290,11 +290,9 @@ function parser(text, json){ var token = peek(e1, e2, e3, e4); if (token) { if (json && !token.json) { - index = token.index; throwError("is not valid json", token); } tokens.shift(); - this.currentToken = token; return token; } return false; -- cgit v1.2.3