@tomhughes commented on this pull request.
> endpoint.setValue(value);
}
+ function findDatalistOption(value) {
+ if (!datalist || !datalist.length) return null;
As we always provide a datalist I don't think this is required? The value
should never be null and if the length is zero then we just won't match in the
loop?
> @@ -84,6 +109,10 @@ OSM.DirectionsEndpoint = function Endpoint(map, input,
> marker, dragCallback, cha
delete endpoint.value;
input.val("");
map.removeLayer(endpoint.marker);
+
+ if (datalist && datalist.length) {
Same goes here - datalist should always be set and calling empty on an empty
list should be safe?
> + setLatLng(L.latLng(lat, lon));
+ endpoint.value = value;
+ input.val(value);
+ changeCallback();
This is duplicating code in `setValue` so I think we need to share that - could
we not just use `setValue` here if we passed in the lat/lon object? Obviously
it would then only look for lat/lon in the text if that argument wasn't
passed...
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6765#pullrequestreview-3735399416
You are receiving this because you are subscribed to this thread.
Message ID:
<openstreetmap/openstreetmap-website/pull/6765/review/[email protected]>_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev