public function filterCallback($callback, $_skipHistory = false) { if (!$_skipHistory) { $this->elementsBackup = $this->elements; $this->debug('Filtering by callback'); } $newStack = array(); foreach ($this->elements as $index => $node) { $result = phpQuery::callbackRun($callback, array($index, $node)); if (is_null($result) || !is_null($result) && $result) { $newStack[] = $node; } } $this->elements = $newStack; return $_skipHistory ? $this : $this->newInstance(); }