Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
1.7.1, 1.8 M1
-
None
-
javascript clean
-
Description
Currently a lot of JS methods and properties are defined in the javascript global (window) object. This is a bad practice for several reasons: first, it makes those methods and properties public APIs that developers can use where we do not want necessarily to support them in the long run. Second, we potentially are more subject to overlap errors (for example if the global method doSomething() is defined in several of our xwiki js libs, the latest one included will erase other definitions, and potentially break behavior of libraries defined upstream)
Actions to be undertaken for this cleaning:
- move "utility" (non-public) methods and variables inside locally scoped code blocks
- move public methods and variables in a proper namespace under the global object