Change setBody to be less strict when getting the immediate child

Step four of the dom document body calls for throwing an exception
if no document element was found. The current setBody implementation
was looking for a document element that is also an html element. It
has been updated to use GetDocumentElement which returns any document
element.
This commit is contained in:
Kris Tokarz 2019-09-29 07:34:36 -04:00
parent 5518951143
commit b567cc76e5

View file

@ -3996,7 +3996,7 @@ impl DocumentMethods for Document {
return Ok(());
}
match (self.get_html_element(), &old_body) {
match (self.GetDocumentElement(), &old_body) {
// Step 3.
(Some(ref root), &Some(ref child)) => {
let root = root.upcast::<Node>();