Class: Detergent::Matchers::ObviousJunkMatcher
- Inherits:
-
Object
- Object
- Detergent::Matchers::ObviousJunkMatcher
- Defined in:
- lib/detergent/matchers/obvious_junk_matcher.rb
Overview
First-pass matcher: junk that can be removed on sight, before any content scoring happens.
Instance Method Summary collapse
Instance Method Details
#match?(node) ⇒ Boolean
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/detergent/matchers/obvious_junk_matcher.rb', line 8 def match?(node) tag = node.name.downcase # Always remove these tags return true if JUNK_TAGS.include?(tag) # Remove hidden elements return true if node['aria-hidden'] == 'true' return true if Detergent.display_none?(node) # Remove structural navigation return true if CHROME_TAGS.include?(tag) return true if node['role'].to_s.downcase == 'navigation' false end |