Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[XHTML] innerHTML and outerHTML setters use a wrong default namespace
https://bugs.webkit.org/show_bug.cgi?id=243441 Reviewed by Chris Dumez. Fixed the bug that the setters of innerHTML and outerHTML use a wrong default namespace URI. The new behavior matches that of Firefox and Chrome. * LayoutTests/fast/parser/innerHTML-setter-default-namespace-expected.txt: Added. * LayoutTests/fast/parser/innerHTML-setter-default-namespace.xhtml: Added. * Source/WebCore/xml/parser/XMLDocumentParser.cpp: (WebCore::findXMLParsingNamespaces): Canonical link: https://commits.webkit.org/253039@main
- Loading branch information
Showing
3 changed files
with
41 additions
and
7 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
LayoutTests/fast/parser/innerHTML-setter-default-namespace-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
PASS Setting innerHTML on a HTML element with a non-HTML namespace as the default namespace | ||
PASS Setting outerHTML on a HTML element with a non-HTML namespace as the default namespace | ||
|
36 changes: 36 additions & 0 deletions
36
LayoutTests/fast/parser/innerHTML-setter-default-namespace.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:bar="bar"> | ||
<head> | ||
<title>Test for Shadow DOM innerHTML setter in XML</title> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<span xmlns="someNamespace" xmlns:html="http://www.w3.org/1999/xhtml"> | ||
<html:span id="target"/> | ||
</span> | ||
<script> | ||
<![CDATA[ | ||
|
||
test(() => { | ||
const element = document.getElementById("target"); | ||
element.innerHTML = '<b /><html:b />'; | ||
assert_equals(element.firstChild.prefix, null); | ||
assert_equals(element.firstChild.namespaceURI, "someNamespace"); | ||
assert_equals(element.lastChild.prefix, 'html'); | ||
assert_equals(element.lastChild.namespaceURI, "http://www.w3.org/1999/xhtml"); | ||
}, "Setting innerHTML on a HTML element with a non-HTML namespace as the default namespace"); | ||
|
||
test(() => { | ||
const element = document.getElementById("target"); | ||
element.outerHTML = '<b /><html:b />'; | ||
assert_equals(element.firstChild.prefix, null); | ||
assert_equals(element.firstChild.namespaceURI, "someNamespace"); | ||
assert_equals(element.lastChild.prefix, 'html'); | ||
assert_equals(element.lastChild.namespaceURI, "http://www.w3.org/1999/xhtml"); | ||
}, "Setting outerHTML on a HTML element with a non-HTML namespace as the default namespace"); | ||
|
||
]]> | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters