/**
 *  @requires function-extensions dom
 *  @provides control-dom
 */

function /* class */ DOMControl(root) {
  copy_properties(this, {
        root : root && $(root),
    updating : false
  });


  if (root) {
    root.getControl = identity.bind(null, this);
  }
}

copy_properties(DOMControl.prototype, {
  getRoot : function() {
    return this.root;
  },
  beginUpdate : function() {
    if (this.updating) {
      return false;
    }
    this.updating = true;
    return true;
  },
  endUpdate : function() {
    this.updating = false;
  },
  update : function() {
    if (!this.beginUpdate()) {
      return this;
    }
    this.onupdate();
    this.endUpdate();
  }
});

