diff --git a/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp b/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp index 3e8b1be02fd..94ddd8811b1 100644 --- a/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp +++ b/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp @@ -113,7 +113,18 @@ void XMLDocumentBuilder::element_start(const XML::Name& name, HashMap prefix = {}; + auto local_name = qualified_name; + + if (qualified_name.bytes_as_string_view().contains(':')) { + auto parts = qualified_name.bytes_as_string_view().split_view(':'); + prefix = MUST(FlyString::from_utf8(parts[0])); + local_name = MUST(FlyString::from_utf8(parts[1])); + } + + auto node = DOM::create_element(m_document, local_name, m_namespace, prefix).release_value_but_fixme_should_propagate_errors(); // When an XML parser with XML scripting support enabled creates a script element, // it must have its parser document set and its "force async" flag must be unset. diff --git a/Tests/LibWeb/Text/expected/wpt-import/dom/nodes/Element-firstElementChild-namespace-xhtml.txt b/Tests/LibWeb/Text/expected/wpt-import/dom/nodes/Element-firstElementChild-namespace-xhtml.txt new file mode 100644 index 00000000000..8ef5d111284 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/dom/nodes/Element-firstElementChild-namespace-xhtml.txt @@ -0,0 +1,11 @@ +Summary + +Harness status: OK + +Rerun + +Found 1 tests + +1 Pass +Details +Result Test Name MessagePass firstElementChild with namespaces \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/dom/nodes/Element-firstElementChild-namespace-xhtml.xhtml b/Tests/LibWeb/Text/input/wpt-import/dom/nodes/Element-firstElementChild-namespace-xhtml.xhtml new file mode 100644 index 00000000000..d420bfda40d --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/dom/nodes/Element-firstElementChild-namespace-xhtml.xhtml @@ -0,0 +1,28 @@ + + + +firstElementChild with namespaces + + + + +

Test of firstElementChild with namespaces

+
+ +
+
+

The result of this test is +logged above.

+ + +