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

ELEMENT_NODE is missing from the node instance #433

Closed
silvenon opened this issue Mar 29, 2022 · 1 comment · Fixed by #437
Closed

ELEMENT_NODE is missing from the node instance #433

silvenon opened this issue Mar 29, 2022 · 1 comment · Fixed by #437
Assignees
Labels
bug Something isn't working

Comments

@silvenon
Copy link

Hi! I noticed that instances of Node, or at least HTMLElement, don't have the ELEMENT_NODE property.

const { Window } = require('happy-dom')

const window = new Window();
const document = window.document;

document.body.innerHTML = '<div class="container"></div>';

console.log(document.querySelector('.container').ELEMENT_NODE) // undefined

I discovered this while migrating from Jest to Vitest, and at the same time moving from jsdom to happy-dom. I noticed that computing the accessible name of elements started coming up empty in Testing Library, which uses dom-accessibility-api for that functionality, which relies on ELEMENT_NODE. (It was quite a debugging trip! 😄)

I see ELEMENT_NODE in your codebase, though 🤔 so hopefully you'll be able to shed some light on this, thanks! 🤞

@capricorn86 capricorn86 added the bug Something isn't working label Mar 29, 2022
@capricorn86 capricorn86 self-assigned this Mar 30, 2022
capricorn86 pushed a commit that referenced this issue Mar 30, 2022
…n the instance. It it currently only available statically.
capricorn86 added a commit that referenced this issue Mar 30, 2022
…sing-from-the-node-instance

#433@minor: Adds support for Node.ELEMENT_NODE, Node.TEXT_NODE etc. o…
@capricorn86
Copy link
Owner

Thank you for reporting @silvenon! 🙂

I have fixed the issue now.

You can read more about the release here:
https://github.com/capricorn86/happy-dom/releases/tag/v2.52.0

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