public function outerHtml() : string { if (!\count($this)) { throw new \InvalidArgumentException('The current node list is empty.'); } $node = $this->getNode(0); $owner = $node->ownerDocument; if ($this->html5Parser && '<!DOCTYPE html>' === $owner->saveXML($owner->childNodes[0])) { $owner = $this->html5Parser; } return $owner->saveHTML($node); }