From 29ff9ec97037cecc86946fed4035e682462cd7c9 Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Fri, 23 Dec 2011 08:16:27 -0500 Subject: [PATCH] prevent selected option from being included twice in the HTML --- lib/country-select.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/country-select.rb b/lib/country-select.rb index d28db95..74c04a5 100644 --- a/lib/country-select.rb +++ b/lib/country-select.rb @@ -20,6 +20,10 @@ def country_options_for_select(selected = nil, priority_countries = nil) end country_options += options_for_select(priority_countries, selected) country_options += "\n" + # prevents selected from being included twice in the HTML which causes + # some browsers to select the second selected option (not priority) + # which makes it harder to select an alternative priority country + selected=nil if priority_countries.include?(selected) end return country_options + options_for_select(COUNTRIES, selected)