lib/SpaceView/index.js
function (space) {
  // Parameters
  //   space
  //     a Space, optional, default to null.

  AbstractRectangle.call(this)

  // This is the DOM container. Populated in mount().
  this._el = null

  // Mapping from AbstractNode#id to HTMLElement
  // Every HTMLElement created by the view is stored here.
  this._elements = {}
  // Mapping from AbstractNode#id to a map from an event name to a handler fn.
  // Event handlers of every rendered AbstractNode are stored here.
  this._handlers = {}
  // Mapping from an event name to a handler fn.
  // Handlers for the view's events like 'added'. Populated in mount().
  this._viewHandlers = {}

  // View is now ready to be added onto the space.
  // Note that this implicitly sets
  //   this._parent = space
  // Therefore, to access the space, call this.getParent() or this._parent

  if (typeof space === 'object') {
    // Test if valid space
    if (!(space instanceof Space)) {
      throw new Error('Parent of a View must be a Space.')
    }
    this.setParent(space)
  }
}
function (space) {
  // Parameters
  //   space
  //     a Space, optional, default to null.

  AbstractRectangle.call(this)

  // This is the DOM container. Populated in mount().
  this._el = null

  // Mapping from AbstractNode#id to HTMLElement
  // Every HTMLElement created by the view is stored here.
  this._elements = {}
  // Mapping from AbstractNode#id to a map from an event name to a handler fn.
  // Event handlers of every rendered AbstractNode are stored here.
  this._handlers = {}
  // Mapping from an event name to a handler fn.
  // Handlers for the view's events like 'added'. Populated in mount().
  this._viewHandlers = {}

  // View is now ready to be added onto the space.
  // Note that this implicitly sets
  //   this._parent = space
  // Therefore, to access the space, call this.getParent() or this._parent

  if (typeof space === 'object') {
    // Test if valid space
    if (!(space instanceof Space)) {
      throw new Error('Parent of a View must be a Space.')
    }
    this.setParent(space)
  }
}
Constructor