public function prev($selector=null)
    {
        $result = $this->createChildInstance();

        if (isset($this->document) && $this->length > 0) {
            foreach ($this->nodes as $node) { // get all previous sibling of all nodes
                if ($prev = self::getPreviousElement($node)) {
                    $result->addDomNode($prev);
                }
            }

            if ($selector) {
                $result = $result->filter($selector);
            }
        }

        return $result;
    }
public function prev($selector=null)
    {
        $result = $this->createChildInstance();

        if (isset($this->document) && $this->length > 0) {
            foreach ($this->nodes as $node) { // get all previous sibling of all nodes
                if ($prev = self::getPreviousElement($node)) {
                    $result->addDomNode($prev);
                }
            }

            if ($selector) {
                $result = $result->filter($selector);
            }
        }

        return $result;
    }
public function prev ( $ selector = null ) { $ result = $ this -> createChildInstance ( ) ; if ( isset ( $ this -> document ) && $ this -> length > 0 ) { foreach ( $ this -> nodes as $ node ) { // get all previous sibling of all nodes if ( $ prev = self :: getPreviousElement ( $ node ) ) { $ result -> addDomNode ( $ prev ) ; } } if ( $ selector ) { $ result = $ result -> filter ( $ selector ) ; } } return $ result ; }
Returns DomQuery with immediately preceding sibling of all nodes

@param string|self|callable|\DOMNodeList|\DOMNode|null $selector expression that filters the set of matched elements

@return self
Returns DomQuery with immediately preceding sibling of all nodes