public function QueryPath::replaceWith in QueryPath 6
Same name and namespace in other branches
- 7.3 QueryPath/QueryPath.php \QueryPath::replaceWith()
- 7.2 QueryPath/QueryPath.php \QueryPath::replaceWith()
File
- QueryPath/
QueryPath.php, line 722
Class
Code
public function replaceWith($new) {
$data = $this
->prepareInsert($new);
$found = new SplObjectStorage();
foreach ($this->matches as $m) {
$parent = $m->parentNode;
$parent
->insertBefore($data
->cloneNode(TRUE), $m);
$found
->attach($parent
->removeChild($m));
}
$this
->setMatches($found);
return $this;
}