Skip to content

<table> is not rendered correctly in .astro components with is:raw #715

@Yixuan-Wang

Description

@Yixuan-Wang

What version of astro are you using?

2.0.2

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

pnpm

What operating system are you using?

Linux(WSL)

Describe the Bug

The following .astro component code produces wrong HTML rendering results.

---
const html = `<table is:raw><thead><tr><th>a</th><th align="left">b</th><th align="right">c</th><th align="center">d</th></tr></thead><tbody><tr><td>1</td><td align="left">2</td><td align="right">3</td><td align="center">4</td></tr></tbody></table>`;
---
<table is:raw><thead><tr><th>a</th><th align="left">b</th><th align="right">c</th><th align="center">d</th></tr></thead><tbody><tr><td>1</td><td align="left">2</td><td align="right">3</td><td align="center">4</td></tr></tbody></table>
<hr>
<Fragment set:html={html}>

图片

The component is compiled into the following HTML, which is not desired.

abcd1234
<table></table>

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-wzww1o?file=src/pages/index.astro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

Labels

- P3: minor bugAn edge case that only affects very specific usage (priority)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions