mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
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
<html>, <head>, and <body> tags. This will have prevented document.title
from detecting the document element is an SVG element.
This commit is contained in:
parent
c8d8640018
commit
3a28be2a98
1 changed files with 1 additions and 1 deletions
|
@ -181,7 +181,7 @@ static bool build_video_document(DOM::Document& document)
|
||||||
bool parse_document(DOM::Document& document, ByteBuffer const& data)
|
bool parse_document(DOM::Document& document, ByteBuffer const& data)
|
||||||
{
|
{
|
||||||
auto& mime_type = document.content_type();
|
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);
|
auto parser = HTML::HTMLParser::create_with_uncertain_encoding(document, data);
|
||||||
parser->run(document.url());
|
parser->run(document.url());
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue