}
}
- $doc->removeChild($doc->doctype); //remove doctype
+ $doc->removeChild($doc->firstChild); //remove doctype
$doc = strip_harmful_tags($doc, $allowed_elements, $disallowed_attributes);
if ($highlight_words) {
}
}
- $body = $doc->getElementsByTagName("body")->item(0);
-
- if ($body) {
- $div = $doc->createElement("div");
-
- foreach ($body->childNodes as $child) {
- $div->appendChild($child);
- }
-
- $res = $doc->saveXML($div);
- } else {
- $res = $doc->saveHTML();
- }
+ $res = $doc->saveHTML();
return $res;
}