code: function () {
        var activeObject = this.getActiveGroup() || this.getActiveObject();
        if (activeObject) {
          this.fire('before:selection:cleared', { target: activeObject });
        }
        this.deactivateAll();
        if (activeObject) {
          this.fire('selection:cleared');
        }
        return this;
      }
docs: Deactivates all objects and dispatches appropriate events
  @method deactivateAllWithDispatch
  @return {fabric.Canvas} thisArg