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

Calling new HTMLElement() throws exception #1481

Open
gerbyzation opened this issue Jul 9, 2024 · 0 comments
Open

Calling new HTMLElement() throws exception #1481

gerbyzation opened this issue Jul 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@gerbyzation
Copy link

gerbyzation commented Jul 9, 2024

Describe the bug
happy-dom@>13.0.5 throws an exception when calling new HTMLElement()

To Reproduce

// repro.mjs
import { HTMLElement } from "happy-dom";

const el = new HTMLElement();
$ node repro.mjs
file:///Users/gerbenneven/projects/some-project/node_modules/.pnpm/happy-dom@14.12.3/node_modules/happy-dom/lib/nodes/node/Node.js:34
                throw new Error('Failed to construct "Node": No owner document in queue. Please use "NodeFactory" to create instances of a Node.');
                      ^

Error: Failed to construct "Node": No owner document in queue. Please use "NodeFactory" to create instances of a Node.
    at new Node (file:///Users/gerbenneven/projects/some-project/node_modules/.pnpm/happy-dom@14.12.3/node_modules/happy-dom/lib/nodes/node/Node.js:34:23)
    at new Element (file:///Users/gerbenneven/projects/some-project/node_modules/.pnpm/happy-dom@14.12.3/node_modules/happy-dom/lib/nodes/element/Element.js:28:9)
    at new HTMLElement (file:///Users/gerbenneven/projects/some-project/node_modules/.pnpm/happy-dom@14.12.3/node_modules/happy-dom/lib/nodes/html-element/HTMLElement.js:32:9)
    at file:///Users/gerbenneven/projects/some-project/dom-test.mjs:3:12
    at ModuleJob.run (node:internal/modules/esm/module_job:217:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:308:24)
    at async loadESM (node:internal/process/esm_loader:42:7)
    at async handleMainPromise (node:internal/modules/run_main:66:12)

Node.js v20.6.1

Expected behavior
No exception to throw. Earlier versions (happy-dom@<=13.0.5) supported this without issue

Device:

  • OS: macOS Sonoma 14.05
  • Browser: n/a
  • Version: node 20.6.1

Additional context
Add any other context about the problem here.

@gerbyzation gerbyzation added the bug Something isn't working label Jul 9, 2024
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

No branches or pull requests

1 participant