This commit is contained in:
Lucien Fiorini 2024-11-20 20:01:47 -05:00 committed by GitHub
commit 5fe9b1de65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 51 additions and 1 deletions

View file

@ -113,7 +113,18 @@ void XMLDocumentBuilder::element_start(const XML::Name& name, HashMap<XML::Name,
m_namespace = Namespace::HTML; 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(); auto qualified_name = MUST(FlyString::from_deprecated_fly_string(name));
Optional<FlyString> 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, // 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. // it must have its parser document set and its "force async" flag must be unset.

View file

@ -0,0 +1,11 @@
Summary
Harness status: OK
Rerun
Found 1 tests
1 Pass
Details
Result Test Name MessagePass firstElementChild with namespaces

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:pickle="http://ns.example.org/pickle">
<head>
<title>firstElementChild with namespaces</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<h1>Test of firstElementChild with namespaces</h1>
<div id="parentEl">
<pickle:dill id="first_element_child"/>
</div>
<div id="log"></div>
<p id="parentEl">The result of this test is
<span id="first_element_child" style="font-weight:bold;">logged above.</span></p>
<script><![CDATA[
test(function() {
var parentEl = document.getElementById("parentEl");
var fec = parentEl.firstElementChild;
assert_true(!!fec)
assert_equals(fec.nodeType, 1)
assert_equals(fec.getAttribute("id"), "first_element_child")
assert_equals(fec.localName, "dill")
})
]]></script>
</body>
</html>