core: :class="undefined" causes class being rendered

Version

3.2.6

Steps to reproduce

<template>
  <div :title="undefined" :class="undefined" :style="undefined">
    Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolore molestiae quod voluptas
    reprehenderit possimus nihil eligendi iure et esse aut, iste natus porro enim rerum cumque
    veniam quae! Quam, voluptatum.
  </div>
</template>

What is expected?

None of title, class, style should be rendered.

What is actually happening?

class is rendered, the same thing applies to null.

Additional info

This was fixed in v3.1.5 but is reproducible when using the latest commit.

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 7
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

The issue still exists, does anyone have any solution?

https://github.com/vuejs/rfcs/blob/master/active-rfcs/0024-attribute-coercion-behavior.md#drawbacks https://vuejs.org/guide/essentials/template-syntax.html#attribute-bindings

when I use null, empty class property remains in the tag.

Vue version: 3.3.4