root = pQuery::parseStr('

italicprevious textnext textbolded

'); } function testItDeepSplitsDOMTreeByElement() { $a = $this->root->query('a'); assert($a instanceof pQuery); DOMUtil::splitOn($this->root, $a->offsetGet(0)); expect($this->root->html())->equals( '

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); } }