View Single Post
Old 06-02-2012, 02:46 AM   #11
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 6,091
Karma: 4571547
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
A tool that can detect unused/undefined styles would be very useful indeed. Just note that unused styles could be more that just classes. A stylesheet could contain something like this:

Code:
div p.caption { ... }
and if the XHTML does contain <p class="caption">, but not inside a <div>, the above style would be unused. So a CSS checking tool should be a little more sophisticated.

A possible hackish way to look for unused styles: Set everything to display:none, except for one selector. Open the files in a browser. If you see anything, that selector is being used there. Repeat with a different selector, etc.

Finding all undefined styles is harder/impossible. How could an automated tool know that, for this:

Code:
<div class="poetry">
<p>...</p>
<p>...</p>
</div>
the "div.poetry p" style is missing?
Jellby is offline   Reply With Quote