Permalink
Browse files

Chrome is not considered Safari anymore.

  • Loading branch information...
1 parent ec471bd commit 5931410ad3d37e75020832a6abefa1781a53c24f @fnando committed Oct 27, 2010
Showing with 7 additions and 6 deletions.
  1. +5 −4 lib/browser.rb
  2. +2 −2 test/browser_test.rb
View
@@ -202,7 +202,7 @@ def full_version
# Return true if browser supports some CSS 3 (Safari, Firefox, Opera & IE7+).
def capable?
- safari? || firefox? || opera? || (ie? && version >= "7")
+ webkit? || firefox? || opera? || (ie? && version >= "7")
end
# Detect if browser is WebKit-based.
@@ -247,7 +247,7 @@ def ipod?
# Detect if browser is Safari.
def safari?
- !!(ua =~ /Safari/)
+ ua =~ /Safari/ && ua !~ /Chrome/
end
# Detect if browser is Firefox.
@@ -325,8 +325,9 @@ def platform
def meta
Array.new.tap do |m|
m << id
- m << "webkit safari safari#{version}" if safari?
- m << "#{id}#{version}" unless safari?
+ m << "webkit" if webkit?
+ m << "safari safari#{version}" if safari?
+ m << "#{id}#{version}" unless safari? || chrome?
m << platform
m << "capable" if capable?
m << "mobile" if mobile?
@@ -181,7 +181,7 @@ def test_detect_chrome
assert_equal "Chrome", @browser.name
assert @browser.chrome?
- assert @browser.safari?
+ assert !@browser.safari?
assert @browser.webkit?
assert @browser.capable?
assert_equal "5.0.375.99", @browser.full_version
@@ -253,7 +253,7 @@ def test_meta
def test_return_string_representation
@browser.ua = CHROME
- assert_equal "chrome webkit safari safari5 mac capable", @browser.to_s
+ assert_equal "chrome webkit mac capable", @browser.to_s
end
def test_return_string_representation_for_mobile

0 comments on commit 5931410

Please sign in to comment.