Skip to content

Leaflet 2.0.0-alpha DomUtil remove/removeClass deprecations #203

@willfarrell

Description

@willfarrell

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions