DEV Community

Discussion on: How to avoid empty class in Vue with null

Collapse
 
chiubaca profile image
Alex Chiu

What a weird quirk... feels like Vue shouldn't create an empty class on any falsey value . I had a quick look to see if there is bug for this but the closest thing I found was this closed issue - github.com/vuejs/vue/issues/10791

I don't really understand the closing comment

"class and style have a proper handling and, differently from other attributes, when set to undefined, they keep the empty attribute on the element, probably for performance reasons"

πŸ€·β€β™‚οΈ

Collapse
 
samanthaming profile image
Samantha Ming

I guess because it isn't considered invalid, they left it alone. But they do prevent empty id ...since that will throw an error. So I guess that's good then πŸ˜†