@@ -279,9 +279,9 @@ MapboxGeocoder.prototype = {
279279
280280 // Add support for footer.
281281 var parentDraw = typeahead . list . draw ;
282+ var footerNode = this . _footerNode = getFooterNode ( ) ;
282283 typeahead . list . draw = function ( ) {
283284 parentDraw . call ( this ) ;
284- var footerNode = getFooterNode ( ) ;
285285
286286 footerNode . addEventListener ( 'mousedown' , function ( ) {
287287 this . selectingListItem = true ;
@@ -370,6 +370,7 @@ MapboxGeocoder.prototype = {
370370
371371 this . _hideLoadingIcon ( ) ;
372372 this . _showGeolocateButton ( ) ;
373+ this . _hideAttribution ( ) ;
373374 } . bind ( this ) ) ;
374375 } ,
375376
@@ -485,6 +486,14 @@ MapboxGeocoder.prototype = {
485486 this . _loadingEl . style . display = 'none' ;
486487 } ,
487488
489+ _showAttribution : function ( ) {
490+ this . _footerNode . style . display = 'block'
491+ } ,
492+
493+ _hideAttribution : function ( ) {
494+ this . _footerNode . style . display = 'none'
495+ } ,
496+
488497 _onBlur : function ( e ) {
489498 if ( this . options . clearOnBlur ) {
490499 this . _clearOnBlur ( e ) ;
@@ -730,10 +739,12 @@ MapboxGeocoder.prototype = {
730739 if ( res . features . length ) {
731740 this . _showClearButton ( ) ;
732741 this . _hideGeolocateButton ( ) ;
742+ this . _showAttribution ( ) ;
733743 this . _eventEmitter . emit ( 'results' , res ) ;
734744 this . _typeahead . update ( res . features ) ;
735745 } else {
736746 this . _hideClearButton ( ) ;
747+ this . _hideAttribution ( ) ;
737748 this . _typeahead . selected = null ;
738749 this . _renderNoResults ( ) ;
739750 this . _eventEmitter . emit ( 'results' , res ) ;
@@ -743,6 +754,7 @@ MapboxGeocoder.prototype = {
743754 ) . catch (
744755 function ( err ) {
745756 this . _hideLoadingIcon ( ) ;
757+ this . _hideAttribution ( ) ;
746758
747759 // in the event of an error in the Mapbox Geocoding API still display results from the localGeocoder
748760 if ( ( localGeocoderRes . length && this . options . localGeocoder ) || ( externalGeocoderRes . length && this . options . externalGeocoder ) ) {
0 commit comments