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

Astro misparses table HTML #870

Closed
mb21 opened this issue Sep 27, 2023 · 5 comments · Fixed by #885 or #925
Closed

Astro misparses table HTML #870

mb21 opened this issue Sep 27, 2023 · 5 comments · Fixed by #885 or #925
Assignees
Labels
- P4: important Violate documented behavior or significantly improves performance (priority)

Comments

@mb21
Copy link

mb21 commented Sep 27, 2023

Astro Info

Astro                    v3.1.4
Node                     v16.20.0
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             none

Describe the Bug

The Astro template

<table>
    <tr><td>{'foo'}</td></tr>
</table>
<h2>Chats</h2>

is misparsed and emits the HTML:

<table>
  <tr><td>foo</td></tr>
  <h2>Chats</h2>
</table>

which is clearly invalid and not intended.

Browsers parse this as "Chats" appearing above the table containing "foo", instead of below.

What's the expected result?

Output HTML corresponds to the input HTML.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-ewybuh?file=src%2Fpages%2Findex.astro

@mb21 mb21 changed the title Astro misparses table template Astro misparses table HTML Sep 27, 2023
@bluwy
Copy link
Member

bluwy commented Sep 27, 2023

Looks like it's parsing the <table> wrongly, causing anything following the </table> to be inside the table 🤔 (compiler output playground)

@bluwy bluwy transferred this issue from withastro/astro Sep 27, 2023
@mb21
Copy link
Author

mb21 commented Oct 2, 2023

Interestingly, closing the table twice (</table></table>) works 🤷

@bluwy bluwy added the - P4: important Violate documented behavior or significantly improves performance (priority) label Oct 9, 2023
@bluwy
Copy link
Member

bluwy commented Oct 9, 2023

NOTE: withastro/astro#8765 reported a similar issue where the table markup at the top of the file is affecting the lower form markup generated.

@bluwy
Copy link
Member

bluwy commented Nov 29, 2023

Re-opening since it was reverted in #889. Going to continue finding a fix

@bluwy bluwy reopened this Nov 29, 2023
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Nov 29, 2023
@MoustaphaDev MoustaphaDev self-assigned this Dec 20, 2023
@MoustaphaDev
Copy link
Member

MoustaphaDev commented Dec 20, 2023

From your comment in the other issue, I'll assume it's okay if I take this one too @bluwy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly improves performance (priority)
Projects
None yet
3 participants