Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect custom element tag name in innerHTML #1354

Closed
bavoco opened this issue Mar 23, 2024 · 1 comment · Fixed by #1357
Closed

Incorrect custom element tag name in innerHTML #1354

bavoco opened this issue Mar 23, 2024 · 1 comment · Fixed by #1357
Assignees
Labels
bug Something isn't working

Comments

@bavoco
Copy link

bavoco commented Mar 23, 2024

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:

  • Happy-dom: 14.3.3
  • Node: 21.5.0

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

@bavoco bavoco added the bug Something isn't working label Mar 23, 2024
@capricorn86 capricorn86 self-assigned this Mar 24, 2024
capricorn86 added a commit that referenced this issue Mar 24, 2024
…cted using the "new" keyword rendered as <null>
capricorn86 added a commit that referenced this issue Mar 24, 2024
…nt-tag-name-in-innerhtml

fix: [#1354] Fixes bug where the tag name for custom elements constru…
@capricorn86
Copy link
Owner

Thank you for reporting @bavoco! 🙂

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants