Adds a check to make sure the closeButton option is set before focusing

This commit is contained in:
Adam Bramley 2013-11-21 09:16:10 +13:00
parent 0b9918fe4e
commit 5fec57d8ec

View File

@ -7,7 +7,9 @@ L.Marker.include({
if (this._popup && this._map && !this._map.hasLayer(this._popup)) {
this._popup.setLatLng(this._latlng);
this._map.openPopup(this._popup);
this._popup._closeButton.focus();
if (this._popup.options.closeButton) {
this._popup._closeButton.focus();
}
}
return this;