DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 966,155 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in

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

Collapse
 
felipperegazio profile image
Felippe Regazio • Edited on

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 Author • Edited on

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