phpQueryObject::filterCallback PHP Method

filterCallback() public method

.. jQuery difference. Callback: - $index int - $node DOMNode
public filterCallback ( $callback, $_skipHistory = false ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
return phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
    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();
    }