Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

turn on EcmaScript5 strict mode #345

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,15 @@ task :compile => [:init, :compile_scenario, :compile_jstd_scenario_adapter, :gen

File.open(path_to('angular.js'), 'w') do |f|
concat = 'cat ' + deps.flatten.join(' ')
f.write(%x{#{concat}})
f.write(%x{#{concat}}.
gsub(/^\s*['"]use strict['"];?\s*$/, ''). # remove all file-specific strict mode flags
gsub(/'USE STRICT'/, "'use strict'")) # rename the placeholder in angular.prefix
f.write(gen_css('css/angular.css', true))
end

%x(java -jar lib/closure-compiler/compiler.jar \
--compilation_level SIMPLE_OPTIMIZATIONS \
--language_in ECMASCRIPT5_STRICT \
--js #{path_to('angular.js')} \
--js_output_file #{path_to('angular.min.js')})
end
Expand Down
Binary file modified lib/closure-compiler/compiler.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/closure-compiler/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20110322
20110615
4 changes: 3 additions & 1 deletion src/Angular.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

////////////////////////////////////

if (typeof document.getAttribute == $undefined)
Expand Down Expand Up @@ -115,7 +117,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;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/AngularPublic.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var browserSingleton;
/**
* @workInProgress
Expand Down
2 changes: 2 additions & 0 deletions src/Browser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

//////////////////////////////
// Browser
//////////////////////////////
Expand Down
2 changes: 2 additions & 0 deletions src/Compiler.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* Template provides directions an how to bind to a given element.
* It contains a list of init functions which need to be called to
Expand Down
7 changes: 5 additions & 2 deletions src/Injector.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @ngdoc function
* @name angular.injector
Expand Down Expand Up @@ -73,8 +75,9 @@ function createInjector(factoryScope, factories, instanceCache) {
}
}

/*NOT_PUBLIC_YET
* @ngdoc function
/**
* THIS IS NOT PUBLIC DOC YET!
*
* @name angular.annotate
* @function
*
Expand Down
2 changes: 2 additions & 0 deletions src/JSON.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var array = [].constructor;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Resource.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';



function Route(template, defaults) {
Expand Down
2 changes: 2 additions & 0 deletions src/Scope.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

function getter(instance, path, unboundFn) {
if (!path) return instance;
var element = path.split('.');
Expand Down
2 changes: 2 additions & 0 deletions src/angular-bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* The MIT License
*
Expand Down
7 changes: 5 additions & 2 deletions src/angular-mocks.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* The MIT License
*
Expand Down Expand Up @@ -516,15 +518,16 @@ 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',
'setYear', 'toDateString', 'toJSON', 'toGMTString', 'toLocaleFormat', 'toLocaleString',
'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"
Expand Down
1 change: 1 addition & 0 deletions src/angular.prefix
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
'USE STRICT';
(function(window, document, undefined){
2 changes: 2 additions & 0 deletions src/apis.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var angularGlobal = {
'typeOf':function(obj){
if (obj === null) return $null;
Expand Down
2 changes: 2 additions & 0 deletions src/directives.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc overview
Expand Down
4 changes: 3 additions & 1 deletion src/filters.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc overview
Expand Down Expand Up @@ -114,7 +116,7 @@ angularFilter.number = function(number, fractionSize){
pow = Math.pow(10, fractionSize),
whole = '' + number,
formatedText = '',
i;
i, fraction;

if (whole.indexOf('e') > -1) return whole;

Expand Down
2 changes: 2 additions & 0 deletions src/formatters.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc overview
Expand Down
2 changes: 2 additions & 0 deletions src/jqLite.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

//////////////////////////////////
//JQLite
//////////////////////////////////
Expand Down
2 changes: 2 additions & 0 deletions src/jstd-scenario-adapter/Adapter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* JSTestDriver adapter for angular scenario tests
*
Expand Down
2 changes: 2 additions & 0 deletions src/markups.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc overview
Expand Down
4 changes: 2 additions & 2 deletions src/parser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var OPERATORS = {
'null':function(self){return null;},
'true':function(self){return true;},
Expand Down Expand Up @@ -290,11 +292,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;
Expand Down
2 changes: 2 additions & 0 deletions src/sanitizer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/*
* HTML Parser By Misko Hevery ([email protected])
* based on: HTML Parser By John Resig (ejohn.org)
Expand Down
2 changes: 2 additions & 0 deletions src/scenario/Application.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* Represents the application currently being tested and abstracts usage
* of iframes or separate windows.
Expand Down
2 changes: 2 additions & 0 deletions src/scenario/Describe.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* The representation of define blocks. Don't used directly, instead use
* define() in your tests.
Expand Down
2 changes: 2 additions & 0 deletions src/scenario/Future.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* A future action in a spec.
*
Expand Down
2 changes: 2 additions & 0 deletions src/scenario/ObjectModel.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* Maintains an object tree from the runner events.
*
Expand Down
2 changes: 2 additions & 0 deletions src/scenario/Runner.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* Runner for scenarios
*
Expand Down
2 changes: 2 additions & 0 deletions src/scenario/Scenario.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';


/**
* Setup file for the Scenario.
Expand Down
2 changes: 2 additions & 0 deletions src/scenario/SpecRunner.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* This class is the "this" of the it/beforeEach/afterEach method.
* Responsibilities:
Expand Down
2 changes: 2 additions & 0 deletions src/scenario/angular-bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

(function(previousOnLoad){
var prefix = (function(){
var filename = /(.*\/)angular-bootstrap.js(#(.*))?/;
Expand Down
2 changes: 2 additions & 0 deletions src/scenario/dsl.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* Shared DSL statements that are useful to all scenarios.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/scenario/matchers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* Matchers for implementing specs. Follows the Jasmine spec conventions.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/scenario/output/Html.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* User Interface for the Scenario Runner.
*
Expand Down
2 changes: 2 additions & 0 deletions src/scenario/output/Json.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* Generates JSON output into a context.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/scenario/output/Object.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* Creates a global value $result with the result of the runner.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/scenario/output/Xml.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* Generates XML output into a context.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/service/cookieStore.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/cookies.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/defer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/document.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/exceptionHandler.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/hover.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/invalidWidgets.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/location.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var URL_MATCH = /^(file|ftp|http|https):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,
HASH_MATCH = /^([^\?]*)?(\?([^\?]*))?$/,
DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp':21};
Expand Down
2 changes: 2 additions & 0 deletions src/service/log.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/resource.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/route.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/updateView.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/window.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/xhr.bulk.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/xhr.cache.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/xhr.error.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/service/xhr.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc service
Expand Down
2 changes: 2 additions & 0 deletions src/validators.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc overview
Expand Down
2 changes: 2 additions & 0 deletions src/widgets.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* @workInProgress
* @ngdoc overview
Expand Down
Loading