root = pQuery::parseStr('
italicprevious textnext textbolded
italicprevious text
' . 'next textbolded
' ); } function testItFindsTopAncestor() { $img = $this->root->query('img'); assert($img instanceof pQuery); $image = $img->offsetGet(0); $p = $this->root->query('p'); assert($p instanceof pQuery); $paragraph = $p->offsetGet(0); expect(DOMUtil::findTopAncestor($image))->equals($paragraph); } }