astro icon indicating copy to clipboard operation
astro copied to clipboard

🐛 BUG: class:list directive adding class attribute when undefined

Open BryceRussell opened this issue 3 years ago • 3 comments

What version of astro are you using?

v1.0.5

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

None

What package manager are you using?

npm

What operating system are you using?

Windows

Describe the Bug

---
const {
  tag: Tag,
  ...attrs
} = Astro.props
---
<Tag class:list={attrs.class}>
  <slot />
</Tag>

When creating an element dynamically using a prop, if class:list directive is undefined it still adds the 'class' attribute to the element like so: <div class></div>

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-cqnqlh

Participation

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

BryceRussell avatar Jul 20 '22 23:07 BryceRussell