protomaps-leaflet
protomaps-leaflet copied to clipboard
Leaflet 2.0.0-alpha DomUtil remove/removeClass deprecations
When using the new Leaflet 2.0.0-alpha (https://leafletjs.com/2025/05/18/leaflet-2.0.0-alpha.html) and actioning a zoom, deprecated DomUtil functions are triggered.
https://github.com/protomaps/protomaps-leaflet/blob/a5f2c0c8888f4e95bfbda0f7bb5a85be20511eec/src/frontends/leaflet.ts#L342-344
Workaround
Add in the following after import
// https://github.com/Falke-Design/Leaflet-V1-polyfill
L.DomUtil.remove = function (el) {
const parent = el.parentNode
if (parent) {
parent.removeChild(el)
}
}
L.DomUtil.removeClass = (el, name) => el.classList.remove(name)
Happy to open a PR to replace the use of these function. Just let me know.
Leaflet 2.0.0 is a major version bump. since this project isn't very active, we should probably put out a major version 6.0.0 compatible with leaflet >= 2.0.0 only and not attempt to support both leaflet < 2 and >= 2 in the same code.