Documentation
¶
Overview ¶
Command selectorcoverage reports which of a stylesheet's selectors never match a document.
selectorcoverage -selectors rules.txt < page.html selectorcoverage -css site.css < page.html
It cannot check every selector, and saying so is most of the point. lol-html matches the subset a streaming rewriter can decide when it sees a start tag, so anything needing what follows - :last-child, :only-child, :empty - is rejected, along with the sibling combinators, :is/:where/:has, pseudo-elements and state selectors like :hover. Real stylesheets are full of those.
So every selector lands in one of three buckets: matched, never matched, or not checkable with the reason. A tool that quietly dropped the third would report coverage it had not measured.
Each checkable selector costs a handler, and matching cost grows with the number registered, on every element. A stylesheet with thousands of rules is worth splitting across runs rather than registering all at once.