Commits

stefano cudini committed 2e42445 Draft

update events onadd/Remove

  • Participants
  • Parent commits 690a8d1

Comments (0)

Files changed (1)

leaflet-search.js

 		this._alert = this._createAlert('search-alert');
 		this._markerLoc = new SearchMarker([0,0], {marker: this.options.markerLocation});//see below
 		this.setLayer( this._layer );
-		this._map.on({
+		this._input.style.maxWidth = L.DomUtil.getStyle(this._map._container,'width');
+		//TODO resize _input on map resize
+		map.on({
 				'layeradd': this._onLayerAddRemove,
 				'layerremove': this._onLayerAddRemove
-			}, this);
-		this._input.style.maxWidth = L.DomUtil.getStyle(this._map._container,'width');
-		//TODO resize _input on map resize
+			}, this);		
 		return this._container;
 	},
 
 	onRemove: function(map) {
 		this._recordsCache = {};
-		this._map.off({
+		map.off({
 				'layeradd': this._onLayerAddRemove,
 				'layerremove': this._onLayerAddRemove
 			}, this);