class Watir::Browser

Attributes

stylesheets[RW]

Public Class Methods

new(*args) click to toggle source
# File lib/unused_css/watir.rb, line 9
def initialize(*args)
  @stylesheets = Stylesheets.new
  original_initialize(*args)
end
Also aliased as: original_initialize

Public Instance Methods

check_for_unused_styles!() click to toggle source
# File lib/unused_css/watir.rb, line 25
def check_for_unused_styles!
  @stylesheets.each do |stylesheet|
    stylesheet.unused_styles.delete_if { |style| self.element(css: style).exist? }
    stylesheet.remove_pseudo_styles!
  end
end
goto(*args) click to toggle source
# File lib/unused_css/watir.rb, line 15
def goto(*args)
  original_goto(*args)
  @stylesheets.add stylesheets_on_page
  check_for_unused_styles!
end
Also aliased as: original_goto
original_goto(*args)
Alias for: goto
original_initialize(*args)
Alias for: new
stylesheets_on_page() click to toggle source
# File lib/unused_css/watir.rb, line 21
def stylesheets_on_page
  elements(tag_name: 'link').map { |stylesheet| stylesheet.attribute_value('href') }
end