Describe the bug
happy-dom messes up the original DOM structure within <caption>-elements for tables, if there are other elements inside the <caption>, which is allowed according to the specifications. It works as expected when there is only a text node inside.
To Reproduce
The following snippet ...
import { Window } from "happy-dom";
const window = new Window({
url: "http://localhost:8000",
});
window.document.write(`<!DOCTYPE html>
<html>
<head>
<title>Table test</title>
</head>
<body>
<table>
<caption>
<small>
This <b>is</b> a caption.
</small>
</caption>
<thead>
</thead>
<tbody>
</tbody>
</table>
</body>
</html>`);
console.log(window.document.documentElement.outerHTML);
... prints this:
<html><head>
<title>Table test</title>
</head>
<body>
<small></small><b></b><table>
<caption>
</caption>
This is a caption.
<thead>
</thead>
<tbody>
</tbody>
</table>
</body></html>
Expected behavior
The DOM structure inside the <caption>-element should be preserved.
Device:
- OS: tested on macOS & Ubuntu
- Node 23.11.1
- happy-dom Version: 20.4.0
Describe the bug
happy-dom messes up the original DOM structure within
<caption>-elements for tables, if there are other elements inside the<caption>, which is allowed according to the specifications. It works as expected when there is only a text node inside.To Reproduce
The following snippet ...
... prints this:
Expected behavior
The DOM structure inside the
<caption>-element should be preserved.Device: