root = pQuery::parseStr('

italicprevious textnext textbolded

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

italicprevious text

' . '' . '

next textbolded

' ); } public function testItFindsTopAncestor() { $img = $this->root->query('img'); assert($img instanceof pQuery); $image = $img->offsetGet(0); assert($image instanceof DomNode); $p = $this->root->query('p'); assert($p instanceof pQuery); $paragraph = $p->offsetGet(0); expect(DOMUtil::findTopAncestor($image))->equals($paragraph); } }