Move 'use strict' declaration inside of class
davidmyersdev opened this issue · 4 comments
You might want to consider moving the 'use strict' declaration to the first line inside your class definition instead of leaving it in the global scope. If you leave it outside, it will affect other scripts that someone might also include in their project and therefore might not follow the same 'strict' standards.
Actually, 'use strict'; only applies to JavaScript "program scope". Each file or script element has its own program scope, so 'use strict'; will only apply to the gridfader.js file
You can read more about program scope and code units here: www.ecma-international.org/ecma-262/5.1/#sec-4.2.2
The intention was to force the coding inside the entire script file to be strict. I hoped that if anyone modified or extended the file with additional objects or namespaces that it would help enforce better coding standards.
If this resolution is acceptable, please let me know, and I will close the issue.
That is true, but under the circumstance that someone concatenates your file to theirs in the process of minification, it would still "leak" into other scripts.
That is a very fair point.