Permalink
Browse files

Skip selectors which are empty after stripping.

(Did *no-one* already have this problem?)
  • Loading branch information...
1 parent bfe4e0d commit b485ad4d29c3a9bd293607186c1d6504d8742fd1 @aanand committed Mar 4, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/deadweight.rb
View
6 lib/deadweight.rb
@@ -39,7 +39,11 @@ def analyze(html)
@unused_selectors.collect do |selector, declarations|
# We test against the selector stripped of any pseudo classes,
# but we report on the selector with its pseudo classes.
- unless doc.search(strip(selector)).empty?
+ stripped_selector = strip(selector)
+
+ next if stripped_selector.empty?
+
+ if doc.search(stripped_selector).any?
log.puts(" #{selector.green}")
selector
end

0 comments on commit b485ad4

Please sign in to comment.