Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Empty Class Definition Trap?

Every once in a while I define an empty CSS class such as

.empty{}

to enable me to manipulate a whole sequence of DOM elements easily in jQuery. From what I have seen thus far all the major browsers allow me to get away with this. However, I was wondering... are there any W3C guidelines that might mean that one day browsers strip out/ignore such empty class declarations? I have scanned the, oh so dry, W3C documentation but have not been able to find anything terribly relevant on the subject.

like image 937
DroidOS Avatar asked May 11 '26 09:05

DroidOS


1 Answers

As I understand, you just use this class as a hook to get the desired elements via jQuery. Nothing wrong with that, will work forever (or till the zombie apocalypse).

Browsers will never start and just remove any elements which are completely valid.

I am pretty gutsy in saying "never" :-D

But there is no need for a CSS-declaration for that class which has no properties at all. But it doesn't hurt either.

like image 92
dave Avatar answered May 14 '26 09:05

dave