Crawler.php
public function parents()
    {
        if (!$this->nodes) {
            throw new \InvalidArgumentException('The current node list is empty.');
        }

        $node = $this->getNode(0);
        $nodes = array();

        while ($node = $node->parentNode) {
            if (XML_ELEMENT_NODE === $node->nodeType) {
                $nodes[] = $node;
            }
        }

        return $this->createSubCrawler($nodes);
    }
public function parents()
    {
        if (!$this->nodes) {
            throw new \InvalidArgumentException('The current node list is empty.');
        }

        $node = $this->getNode(0);
        $nodes = array();

        while ($node = $node->parentNode) {
            if (XML_ELEMENT_NODE === $node->nodeType) {
                $nodes[] = $node;
            }
        }

        return $this->createSubCrawler($nodes);
    }
public function parents ( ) { if ( ! $ this -> nodes ) { throw new \ InvalidArgumentException ( 'The current node list is empty.' ) ; } $ node = $ this -> getNode ( 0 ) ; $ nodes = array ( ) ; while ( $ node = $ node -> parentNode ) { if ( XML_ELEMENT_NODE === $ node -> nodeType ) { $ nodes [ ] = $ node ; } } return $ this -> createSubCrawler ( $ nodes ) ; }
Returns the parents nodes of the current selection.

@return self

@throws \InvalidArgumentException When current node is empty
Returns the parents nodes of the current selection .