question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ERR: The browser resolved template HTML does not match JSX input

See original GitHub issue

What does this if statement do?

if ("_DX_DEV_" && check && t.innerHTML.split("<").length - 1 !== check)
    throw `The browser resolved template HTML does not match JSX input:\n${t.innerHTML}\n\n${html}. Is your HTML properly formed?`;

(Line: 41): https://github.com/ryansolid/dom-expressions/blob/98e890c6b8c2afbd497b715f1d867cd90da6d66a/packages/dom-expressions/src/client.js

I just get a super annoying error when creating tables like this (in production no doubt about it)

<table>
    <tr>Do you really wanna listen to her large mouth instead of playing video games?</tr>
    <tr>Get the hell out of there, dude</tr>
</table>

When I remove these four lines of code everything works. Like, when I remove all the <tr> it works. As I said, in build version everything works just fine, I think there should be a bug, or why should this break?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
leeoniyacommented, Aug 14, 2021

lol, when i saw this issue title i immediately thought, “Bet it’s implicit <tbody>” 😄

i have a devmode warning for this in domvm: https://github.com/domvm/domvm/blob/master/src/view/addons/devmode.js#L58

1reaction
ryansolidcommented, Aug 14, 2021

The REPL might not be in dev mode. The error is correct. The problem is browsers automatically correct poorly formed HTML. We build the DOM using template cloning so we are at the mercy of how they “correct” our templates. In your example every browser adds a <tbody> around the <tr>s. Manually adding it fixes the problem. Ive considered adding code to automatically add the <tbody> just there are a ton of these scenarios. I haven’t found a library that can check for this at compile time as of yet. Would love to smooth this out.

By the way, if the table had dynamic parts it would break in production, because the walks that add effect bindings would be broken.

Read more comments on GitHub >

github_iconTop Results From Across the Web

solidjs-community/community - Gitter
Right now JSX attributes without {} get passed straight through as attributes. ... Uncaught Error: Template html does not match input: ...
Read more >
Solid components using an HTML table won't hydrate #4602
tsx component, you get the following error: (index):13 Uncaught (in promise) The browser resolved template HTML does not match JSX input: <table> ...
Read more >
Text content did not match. Warning in React 16 - Stack Overflow
i'm getting a very similar error - using staticRouter in server and browserRouter in client. i've got a bunch of routes and when...
Read more >
FAQs | React Hook Form - Simple React forms validation
How to create an accessible input error and message? React Hook Form is based on Uncontrolled Components, which gives you the ability to...
Read more >
styled-jsx - npm
styled-jsx/css: if you are getting this error it means that your `css` tagged template literals were not transpiled. to solve this issue you ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found