I got a maintenance job and there is a huge CSS file, in which I found a lot of things like the following:
.xxxx {}
That is, a selector with absolutely nothing in it. I think they are useless, but there are so many of them I start to doubt myself. Am I right that they can be removed safely? Or they actually are doing something and I should keep them?
I'd say it's probably the worst design in history (or a stronger contender to the title...) but it could be used.
See below:
document.styleSheets[0].cssRules[0].style.setProperty('color', 'red');
.randomClass {}
<div class="randomClass">No styling?</div>
You can acces, process, and even modify stylesheets. Even if a selector is empty of styles, that can be modified using code.
So, it's probably very safe to remove, but if you want to be 100% certain, either leave it there, or go through all possible code branches.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With