code: public function detach()
      {
          if ($this->owner) {
              foreach ($this->events() as $event => $handler) {
                  $this->owner->off($event, is_string($handler) ? [$this, $handler] : $handler);
              }
              $this->owner = null;
          }
      }
docs: Detaches the behavior object from the component.
  The default implementation will unset the [[owner]] property
  and detach event handlers declared in [[events]].
  Make sure you call the parent implementation if you override this method.