root = pQuery::parseStr('

italicprevious textnext textbolded

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

italicprevious text

' . '' . '

next textbolded

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