Document DOMImplementationImp::createHTMLDocument(const std::u16string& title) { try { DocumentPtr document = std::make_shared<DocumentImp>(); document->setContentType(u"text/html"); DocumentType doctype = createDocumentType(u"html", u"", u""); // TODO: set node document document->appendChild(doctype); Element html = document->createElement(u"html"); document->appendChild(html); Element head = document->createElement(u"head"); html.appendChild(head); if (!title.empty()) { Element t = document->createElement(u"title"); head.appendChild(t); Text text = document->createTextNode(title); t.appendChild(text); } Element body = document->createElement(u"body"); html.appendChild(body); // TODO: Step 8. return document; } catch (...) { return nullptr; } }