LibWeb/HTML: Use MimeType::is_xml() in HTMLObjectElement for DRYness

Now that we implement this member function, let's use it to keep
things DRY.
This commit is contained in:
Kemal Zebari 2023-10-11 21:59:42 -07:00 committed by Tim Flynn
parent fd157b9a71
commit dcff48356f

View file

@ -229,11 +229,7 @@ static bool is_xml_mime_type(StringView resource_type)
if (!mime_type.has_value()) if (!mime_type.has_value())
return false; return false;
// An XML MIME type is any MIME type whose subtype ends in "+xml" or whose essence is "text/xml" or "application/xml". [RFC7303] return mime_type->is_xml();
if (mime_type->subtype().ends_with_bytes("+xml"sv))
return true;
return mime_type->essence().is_one_of("text/xml"sv, "application/xml"sv);
} }
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-object-element:plugin-11 // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-object-element:plugin-11