Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-3175

Clean the javascript global object from method and properties that should not be exposed

    XMLWordPrintable

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

      See http://ejohn.org/blog/building-a-javascript-library/

      Attachments

        Activity

          People

            Unassigned Unassigned
            jerome Jerome Velociter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: