File tree Expand file tree Collapse file tree 5 files changed +11
-10
lines changed
Expand file tree Collapse file tree 5 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -76,8 +76,8 @@ export var Logo = L.Control.extend({
7676 }
7777 }
7878 var link = this . options . link ;
79- div . innerHTML = "<a href=' " + link + "' target='_blank ' style='border: none;display: block; '>" +
80- "<img src= " + imgSrc + " alt='" + alt + " ' style='border: none;" + styleSize + "margin-right:5px;margin-bottom:2px;white-space: nowrap'> </a>" ;
79+ var imgElement = "<img src= " + imgSrc + " alt='" + alt + " ' style='border: none;" + styleSize + "margin-right:5px;margin-bottom:2px;white-space: nowrap '>";
80+ div . innerHTML = link ? "<a href=' " + link + "' target='_blank ' style='border: none;display: block;'> " + imgElement + "</a>" : imgElement ;
8181 return div ;
8282 }
8383} ) ;
Original file line number Diff line number Diff line change @@ -70,8 +70,8 @@ export class Logo {
7070 }
7171 }
7272 var link = this . link ;
73- this . _container . innerHTML = "<a href= '" + link + "' target='_blank'> " +
74- "<img src=" + imgSrc + " alt= '" + alt + "' style=' " + styleSize + "margin-bottom: 2px'> </a>" ;
73+ var imgElement = "<img src=" + imgSrc + " alt= '" + alt + "' style=' " + styleSize + "margin-bottom: 2px'>" ;
74+ this . _container . innerHTML = link ? "<a href= '" + link + "' target='_blank'> " + imgElement + "</a>" : imgElement ;
7575 this . _createStyleSheet ( ) ;
7676 return this . _container ;
7777 }
Original file line number Diff line number Diff line change 6969 }
7070 }
7171 var link = this . link ;
72- this . _container . innerHTML = "<a href= '" + link + "' target='_blank'> " +
73- "<img src=" + imgSrc + " alt= '" + alt + "' style=' " + styleSize + "margin-bottom: 2px'> </a>" ;
72+ var imgElement = "<img src=" + imgSrc + " alt= '" + alt + "' style=' " + styleSize + "margin-bottom: 2px'>" ;
73+ this . _container . innerHTML = link ? "<a href= '" + link + "' target='_blank'> " + imgElement + "</a>" : imgElement ;
7474 this . _createStyleSheet ( ) ;
7575 return this . _container ;
7676 }
Original file line number Diff line number Diff line change @@ -63,10 +63,8 @@ export class Logo extends Control {
6363 styleSize = "" ;
6464 }
6565 }
66-
67-
68- div . innerHTML = "<a href='" + link + "' target='_blank' style='border: none;display: block;'>" +
69- "<img src=" + imgSrc + " alt='" + alt + "' style='border: none;" + styleSize + "white-space: nowrap;margin-bottom: 2px'></a>" ;
66+ var imgElement = "<img src=" + imgSrc + " alt='" + alt + "' style='border: none;" + styleSize + "white-space: nowrap;margin-bottom: 2px'>" ;
67+ div . innerHTML = link ? "<a href='" + link + "' target='_blank' style='border: none;display: block;'>" + imgElement + "</a>" : imgElement ;
7068 return div ;
7169 }
7270
Original file line number Diff line number Diff line change @@ -63,8 +63,10 @@ describe('mapboxgl_Logo', () => {
6363 var onAdd = logo1 . onAdd ( map ) ;
6464 expect ( onAdd ) . not . toBeNull ( ) ;
6565 expect ( onAdd . nodeName ) . toBe ( "DIV" ) ;
66+ expect ( onAdd . querySelector ( 'a' ) ) . toBeNull ;
6667 // options2 - imageUrl,width
6768 var options2 = {
69+ link : "http://test.com" ,
6870 imageUrl : "http://test.com/test.png" ,
6971 width : 20
7072 } ;
@@ -75,5 +77,6 @@ describe('mapboxgl_Logo', () => {
7577 var onAdd2 = logo2 . onAdd ( map ) ;
7678 expect ( onAdd2 ) . not . toBeNull ( ) ;
7779 expect ( onAdd2 . nodeName ) . toBe ( "DIV" ) ;
80+ expect ( onAdd2 . querySelector ( 'a' ) ) . not . toBeNull ;
7881 } ) ;
7982} ) ;
You can’t perform that action at this time.
0 commit comments