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 HTML string generated #819

Closed
fabiospampinato opened this issue Mar 9, 2023 · 1 comment · Fixed by #920
Closed

Incorrect HTML string generated #819

fabiospampinato opened this issue Mar 9, 2023 · 1 comment · Fixed by #920
Assignees
Labels
bug Something isn't working

Comments

@fabiospampinato
Copy link

fabiospampinato commented Mar 9, 2023

Describe the bug

There's a mismatch between what I get with HappyDOM, and what I get with LinkedDOM or the actual DOM, so I'm pretty sure there's some bug in HappyDOM somewhere.

To Reproduce

  1. cd into this folder https://github.com/vobyjs/voby/tree/master/demo/ssr_esbuild
  2. npm install
  3. Put this console.log(document.getElementById ( 'app' ).innerHTML) here, to log the HTML generated.
  4. npm dev
  5. Go to http:/localhost:3000/counter
  6. Notice how there's a 0 below the <h1>Counter</h1>, as expected.
  7. npm install happy-dom-global.
  8. Replace linkedom-global for happy-dom-global here.
  9. Go to http:/localhost:3000/counter and notice how the logged HTML doesn't have a 0 anymore. You'll still see one in the page because the page is re-rendered client-side, to turn that off comment out this line.

Expected behavior

HappyDOM's output should make LinkeDOM's and the browser's.

Additional context

I'm not exactly sure what the issue is, the only thing I can think of is that calling .nodeValue = 0 maybe doesn't work in Happy DOM, if that's not the issue I'm not sure what it is.

@fabiospampinato fabiospampinato added the bug Something isn't working label Mar 9, 2023
@capricorn86 capricorn86 self-assigned this May 13, 2023
capricorn86 added a commit that referenced this issue May 13, 2023
… to strings in CharacterData.data, CharacterData.nodeValue or CharacterData.textContent.
capricorn86 added a commit that referenced this issue May 13, 2023
…ng-generated

#819@patch: Fixes issue where non-string values did not get converted…
@capricorn86
Copy link
Owner

capricorn86 commented May 13, 2023

Thank you for reporting @fabiospampinato! 🙂

There is a fix released now.

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

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