public function firstInDocument($expression, $type = Query::TYPE_CSS, $wrapNode = true)
    {
        $ownerDocument = $this->getDocument();

        if ($ownerDocument === null) {
            throw new LogicException('Can not search in context without owner document');
        }

        return $ownerDocument->first($expression, $type, $wrapNode, $this->node);
    }
public function firstInDocument($expression, $type = Query::TYPE_CSS, $wrapNode = true)
    {
        $ownerDocument = $this->getDocument();

        if ($ownerDocument === null) {
            throw new LogicException('Can not search in context without owner document');
        }

        return $ownerDocument->first($expression, $type, $wrapNode, $this->node);
    }
public function firstInDocument ( $ expression , $ type = Query :: TYPE_CSS , $ wrapNode = true ) { $ ownerDocument = $ this -> getDocument ( ) ; if ( $ ownerDocument === null ) { throw new LogicException ( 'Can not search in context without owner document' ) ; } return $ ownerDocument -> first ( $ expression , $ type , $ wrapNode , $ this -> node ) ; }
Searches for an node in the owner document using current node as context and returns first element or null.

@param string $expression XPath expression or a CSS selector
@param string $type       The type of the expression
@param bool   $wrapNode   Returns \DiDom\Element if true, otherwise \DOMElement

@return \DiDom\Element|\DOMElement|null
Searches for an node in the owner document using current node as context and returns first element or null .