mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
LibWeb: Convert DOMImplementation to use TRY for error propagation
This commit is contained in:
parent
e758bd303f
commit
91d0088a5b
1 changed files with 3 additions and 9 deletions
|
@ -29,12 +29,8 @@ ExceptionOr<NonnullRefPtr<Document>> DOMImplementation::create_document(const St
|
|||
|
||||
RefPtr<Element> element;
|
||||
|
||||
if (!qualified_name.is_empty()) {
|
||||
auto new_element = xml_document->create_element_ns(namespace_, qualified_name /* FIXME: and an empty dictionary */);
|
||||
if (new_element.is_exception())
|
||||
return new_element.exception();
|
||||
element = new_element.release_value();
|
||||
}
|
||||
if (!qualified_name.is_empty())
|
||||
element = TRY(xml_document->create_element_ns(namespace_, qualified_name /* FIXME: and an empty dictionary */));
|
||||
|
||||
if (doctype)
|
||||
xml_document->append_child(doctype.release_nonnull());
|
||||
|
@ -92,9 +88,7 @@ NonnullRefPtr<Document> DOMImplementation::create_html_document(const String& ti
|
|||
// https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype
|
||||
ExceptionOr<NonnullRefPtr<DocumentType>> DOMImplementation::create_document_type(String const& qualified_name, String const& public_id, String const& system_id)
|
||||
{
|
||||
auto result = Document::validate_qualified_name(qualified_name);
|
||||
if (result.is_exception())
|
||||
return result.exception();
|
||||
TRY(Document::validate_qualified_name(qualified_name));
|
||||
auto document_type = DocumentType::create(document());
|
||||
document_type->set_name(qualified_name);
|
||||
document_type->set_public_id(public_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue