From d76fae7758161e1a5aaaf8ec84c638fdd1c83333 Mon Sep 17 00:00:00 2001 From: Jordan Owens Date: Thu, 17 Aug 2017 14:49:39 -0400 Subject: [PATCH 1/2] Fixes query to select geocoded location from DOM Previously there were cases where matched portions of the location could be munged together. For instance the query: Seattle WA United became: SeattleUnited, WA, United States --- jquery.geocomplete.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.geocomplete.js b/jquery.geocomplete.js index 35fe1c4..6b395ca 100644 --- a/jquery.geocomplete.js +++ b/jquery.geocomplete.js @@ -366,8 +366,8 @@ } // Get the first suggestion's text. - var $span1 = $(".pac-container:visible .pac-item" + selected + ":first span:nth-child(2)").text(); - var $span2 = $(".pac-container:visible .pac-item" + selected + ":first span:nth-child(3)").text(); + var $span1 = $(".pac-container .pac-item" + selected + ":first .pac-item-query").text(); + var $span2 = $(".pac-container .pac-item" + selected + ":first span:nth-child(3)").text(); // Adds the additional information, if available. var firstResult = $span1; From dc9b2931421674f0b1a6fa6ab73c87a3ac16ced6 Mon Sep 17 00:00:00 2001 From: Jordan Owens Date: Thu, 17 Aug 2017 14:56:44 -0400 Subject: [PATCH 2/2] Use a comma when joining location segments --- jquery.geocomplete.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.geocomplete.js b/jquery.geocomplete.js index 6b395ca..80284a8 100644 --- a/jquery.geocomplete.js +++ b/jquery.geocomplete.js @@ -372,7 +372,7 @@ // Adds the additional information, if available. var firstResult = $span1; if ($span2) { - firstResult += " - " + $span2; + firstResult += ", " + $span2; } this.$input.val(firstResult);