capricorn86 / happy-dom

A JavaScript implementation of a web browser without its graphical user interface
MIT License
3.14k stars 189 forks source link

Incorrect custom element tag name in innerHTML #1354

Closed bavoco closed 4 months ago

bavoco commented 4 months ago

Describe the bug The output of a custom element tagname in innerHTML is null.

To Reproduce

// repro.js
import { Window } from "happy-dom";

const win = new Window();

class myCustomElement extends win.HTMLElement {}
win.customElements.define("my-custom-element", myCustomElement);

win.document.body.append(new myCustomElement());
console.log(win.document.body.innerHTML);

Running node repro.js outputs:

<null></null>

Expected behavior

<my-custom-element></my-custom-element>

Version:

Additional context Interestingly console.log(win.document.body.firstChild.tagName) outputs MY-CUSTOM-ELEMENT

capricorn86 commented 4 months ago

Thank you for reporting @bavoco! :slightly_smiling_face:

There is a fix in now: https://github.com/capricorn86/happy-dom/releases/tag/v14.3.5