Skip to content

Commit

Permalink
Ignore unsupported pseudo selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
pwim committed Feb 14, 2012
1 parent 4142cb3 commit 176c4fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/galakei/docomo_css/stylesheet.rb
Expand Up @@ -12,6 +12,8 @@ def apply(doc)
ruleset.each_selector do |selector, declarations_string, specificity|
if selector =~ /a:(link|focus|visited)/
pseudo_styles << "#{selector} { #{declarations_string} }"
elsif selector =~ /:/
Rails.logger.warn("pseudostyle not supported: #{selector}")
else
embed_style(doc, ruleset, selector)
end
Expand Down
8 changes: 8 additions & 0 deletions spec/acceptance/docomo_css_spec.rb
Expand Up @@ -50,6 +50,14 @@ def japanese
page.should_not have_xpath("//link")
end

scenario 'requesting page with unsupported css filter', :driver => :docomo do
FakeWeb.register_uri(:get, 'http://www.galakei.com/external.css', :body => "span:after { content: 'foo' }")
visit '/docomo_css/external'
page.status_code.should == 200
find("span").text.should == "color"
page.should_not have_xpath("//link")
end

scenario 'requesting simple page for docomo with asset host', :driver => :docomo do
old_asset_host = ActionController::Base.asset_host
begin
Expand Down

0 comments on commit 176c4fc

Please sign in to comment.