Skip to content

Commit a80ccd0

Browse files
committed
fix minor url issues
1 parent c76fd4e commit a80ccd0

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

index.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!DOCTYPE html>
12
<html>
23
<head>
34
<meta http-equiv="refresh" content="0; url=./examples/" />

leaflet.wms.js

+18-8
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,23 @@ L.WMS.Overlay = L.LayerGroup.extend({
151151
'transparent': false
152152
},
153153

154-
'initialize': function(url, params) {
154+
'initialize': function(url, options) {
155155
this._url = url;
156156

157-
// Move non-WMS parameters to options object
158-
var options = {};
159-
['crs', 'uppercase', 'tiled', 'attribution'].forEach(function(opt) {
160-
if (params[opt]) {
161-
options[opt] = params[opt];
162-
delete params[opt];
157+
// Move WMS parameters to params object
158+
var optNames = {
159+
'crs': true,
160+
'uppercase': true,
161+
'tiled': true,
162+
'attribution': true
163+
};
164+
var params = {};
165+
for (var opt in options) {
166+
if (options.hasOwnProperty(opt) && !optNames[opt]) {
167+
params[opt] = options[opt];
168+
delete options[opt];
163169
}
164-
});
170+
}
165171
L.setOptions(this, options);
166172
this.wmsParams = L.extend({}, this.defaultWmsParams, params);
167173
},
@@ -183,6 +189,10 @@ L.WMS.Overlay = L.LayerGroup.extend({
183189
'onRemove': function(map) {
184190
if (this._currentOverlay) {
185191
map.removeLayer(this._currentOverlay);
192+
delete this._currentOverlay;
193+
}
194+
if (this._currentUrl) {
195+
delete this._currentUrl;
186196
}
187197
},
188198

0 commit comments

Comments
 (0)