From 3a28be2a9897116bf901c2efea76bc40351da643 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Thu, 8 Jun 2023 11:38:46 -0400 Subject: [PATCH] LibWeb: Parse SVG document types as XML documents We began parsing SVG documents as HTML years ago in commit 05be648. This was long before we had an XML parser, and actually violates the spec. Since SVG documents have a MIME type of "image/svg+xml", the spec mandates the document should be parsed as XML. One impact here is that the SVG document is no longer "fixed" to include , , and tags. This will have prevented document.title from detecting the document element is an SVG element. --- Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp b/Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp index 3986f8d61b..7564a0bdfe 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp +++ b/Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp @@ -181,7 +181,7 @@ static bool build_video_document(DOM::Document& document) bool parse_document(DOM::Document& document, ByteBuffer const& data) { auto& mime_type = document.content_type(); - if (mime_type == "text/html" || mime_type == "image/svg+xml") { + if (mime_type == "text/html") { auto parser = HTML::HTMLParser::create_with_uncertain_encoding(document, data); parser->run(document.url()); return true;