Open
Description
Describe the bug
When you put a standalone <tr></tr>
element in a <template>
and try to get it out with .firstChild
, you get null
instead. This also happens with <tbody>
or <td>
, but NOT with <li>
.
To Reproduce
import { GlobalRegistrator } from '@happy-dom/global-registrator';
GlobalRegistrator.register();
const html = `<tr></tr>`
const elem = document.createElement('template');
elem.innerHTML = html;
const fragment = elem.content;
console.log(fragment.firstChild)
This prints null
.
If you use something like const html =
instead, it returns the
` node.
Expected behavior
When you run this code in the browser, it returns the node <tr></tr>
:
![Screenshot 2025-01-13 14 27 09@2x](https://private-user-images.githubusercontent.com/2098462/402555870-de027d95-4555-49a8-a4a0-8e2312c25e25.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NTE4NTgsIm5iZiI6MTczOTU1MTU1OCwicGF0aCI6Ii8yMDk4NDYyLzQwMjU1NTg3MC1kZTAyN2Q5NS00NTU1LTQ5YTgtYTRhMC04ZTIzMTJjMjVlMjUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTRUMTY0NTU4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTA1MzBhNDE0ZTUzZWM2NjllZjY1NzgxN2YxM2M4ZGI5YWE0YzFiNzc1MTc0Yzg2Y2FhMWU1ZTNlZjU0ZmUwZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.u5TK8sE4FRweK2Zgg8AlJmCWarEfEUau2kcKNmBy8VI)
Device:
System:
OS: macOS 15.0.1
CPU: (10) arm64 Apple M1 Max
Memory: 9.37 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.13.0 - ~/.local/share/mise/installs/node/22/bin/node
npm: 10.9.2 - ~/.local/share/mise/installs/node/22/bin/npm
pnpm: 9.12.3 - ~/.local/share/mise/installs/node/22/bin/pnpm
npmPackages:
@happy-dom/global-registrator: ^16.5.3 => 16.5.3
happy-dom: ^16.5.3 => 16.5.3
Additional context
Add any other context about the problem here.