DEV Community

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

Collapse
 
felipperegazio profile image
Felippe Regazio • Edited

Pretty cool Samantha, thanks! Just a quick comment about something to consider: CSS :not([class]) selector wont be applied for an element with class="". I mean: an element with class="" wont be targeted by :not([class]) - which is right because the attribute class is there.

This could lead to misconceptions and thats why i consider that kind of selector a bad practice. Anyway, some developers use this selector to validate whether the element has classes or not, which became specially dangerous when using Vue, so your post subject is also useful to prevent bugs in this situation.

Collapse
 
samanthaming profile image
Samantha Ming • Edited

Oh, cool! What a fantastic point you made πŸ‘ Thanks for sharing it, definitely need to add it to my notes πŸ”₯