diff --git a/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp b/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp index 3e8b1be02fd..b8c05f5e625 100644 --- a/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp +++ b/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp @@ -92,27 +92,13 @@ void XMLDocumentBuilder::element_start(const XML::Name& name, HashMapvalue)); } else { m_namespace_stack.last().depth += 1; } - if (name == HTML::TagNames::html.to_deprecated_fly_string() && m_namespace != Namespace::HTML) { - // HTML / 2.1.3 XML compatibility: https://html.spec.whatwg.org/#xml - // To ease migration from HTML to XML, user agents conforming to this specification will place elements in HTML - // in the http://www.w3.org/1999/xhtml namespace, at least for the purposes of the DOM and CSS. - // The term "HTML elements" refers to any element in that namespace, even in XML documents. - if (found_explicit_namespace || m_namespace_stack.size() != 1 || m_namespace_stack.last().depth != 2) { - m_has_error = true; - return; - } - m_namespace = Namespace::HTML; - } - auto node = DOM::create_element(m_document, MUST(FlyString::from_deprecated_fly_string(name)), m_namespace).release_value_but_fixme_should_propagate_errors(); // When an XML parser with XML scripting support enabled creates a script element, diff --git a/Tests/LibWeb/Text/expected/wpt-import/domparsing/XMLSerializer-serializeToString.txt b/Tests/LibWeb/Text/expected/wpt-import/domparsing/XMLSerializer-serializeToString.txt new file mode 100644 index 00000000000..3c116ea8fc3 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/domparsing/XMLSerializer-serializeToString.txt @@ -0,0 +1,35 @@ +Summary + +Harness status: OK + +Rerun + +Found 24 tests + +8 Pass +16 Fail +Details +Result Test Name MessagePass check XMLSerializer.serializeToString method could parsing xmldoc to string +Pass check XMLSerializer.serializeToString method could parsing document to string +Pass Check if the default namespace is correctly reset. +Pass Check if there is no redundant empty namespace declaration. +Fail Check if redundant xmlns="..." is dropped. +Pass Check if inconsistent xmlns="..." is dropped. +Fail Check if an attribute with namespace and no prefix is serialized with the nearest-declared prefix +Fail Check if an attribute with namespace and no prefix is serialized with the nearest-declared prefix even if the prefix is assigned to another namespace. +Fail Check if the prefix of an attribute is replaced with another existing prefix mapped to the same namespace URI. +Fail Check if the prefix of an attribute is NOT preserved in a case where neither its prefix nor its namespace URI is not already used. +Fail Check if the prefix of an attribute is replaced with a generated one in a case where the prefix is already mapped to a different namespace URI. +Fail check XMLSerializer.serializeToString escapes attribute values for roundtripping +Fail Check if attribute serialization takes into account of following xmlns:* attributes +Fail Check if attribute serialization takes into account of the same prefix declared in an ancestor element +Fail Check if start tag serialization drops element prefix if the namespace is same as inherited default namespace. +Fail Check if start tag serialization finds an appropriate prefix. +Fail Check if start tag serialization takes into account of its xmlns:* attributes +Fail Check if start tag serialization applied the original prefix even if it is declared in an ancestor element. +Fail Check if start tag serialization does NOT apply the default namespace if its namespace is declared in an ancestor. +Pass +Fail Check if "ns1" is generated even if the element already has xmlns:ns1. +Fail Check if no special handling for XLink namespace unlike HTML serializer. +Pass Check if document fragment serializes. +Pass Check children were included for void elements \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/domparsing/XMLSerializer-serializeToString.html b/Tests/LibWeb/Text/input/wpt-import/domparsing/XMLSerializer-serializeToString.html new file mode 100644 index 00000000000..ef23bebe645 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/domparsing/XMLSerializer-serializeToString.html @@ -0,0 +1,237 @@ + + + + + domparsing Test: XMLSerializer.serializeToString + + + + +

domparsing_XMLSerializer_serializeToString

+ + +