You are here

public function QueryPath::detach in QueryPath 6

Same name and namespace in other branches
  1. 7.3 QueryPath/QueryPath.php \QueryPath::detach()
  2. 7.2 QueryPath/QueryPath.php \QueryPath::detach()

File

QueryPath/QueryPath.php, line 1591

Class

QueryPath

Code

public function detach($selector = NULL) {
  if (!empty($selector)) {
    $this
      ->find($selector);
  }
  $found = new SplObjectStorage();
  $this->last = $this->matches;
  foreach ($this->matches as $item) {
    $found
      ->attach($item->parentNode
      ->removeChild($item));
  }
  $this
    ->setMatches($found);
  return $this;
}