docs/_posts/2025-05-18-leaflet-2.0.0-alpha.md
After two and a half years of hard work, we’re thrilled to announce the first alpha release of Leaflet 2.0!
This release marks a major modernization of the Leaflet codebase. We've dropped support for Internet Explorer, removed legacy methods and polyfills, adopted modern standards like Pointer Events, and now publish Leaflet as an ESM module. The global L is no longer part of the core package (though it’s still available in the bundled version leaflet-global.js for backward compatibility).
BlanketOverlayMouse and Touch events to PointerEventsPoint and LatLng now include a .validate() methodlayers.png with layers.svg for the Control.Layers. Adjust your bundler configuration if necessary.LeafletMap as an alias for Map.L.marker(latlng) ➜ new Marker(latlng)<script> tag to module: <script type='module'>
module-script, assign them to the window object (Not recommended): window.map = mapL with explicit imports from the Leaflet package: import { Marker } from 'leaflet'
importmap: https://leafletjs.com/examples/quick-start/<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script>
const map = L.map('map').setView([51.505, -0.09], 13);
const tiles = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
</script>
<script type="importmap">
{
"imports": {
"leaflet": "https://unpkg.com/[email protected]/dist/leaflet.js"
}
}
</script>
<script type="module">
import {LeafletMap, TileLayer, Marker, Circle, Polygon, Popup} from 'leaflet';
const map = new LeafletMap('map').setView([51.505, -0.09], 13);
const tiles = new TileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
</script>
<script src="https://unpkg.com/[email protected]/dist/leaflet-global.js"></script>
<script>
const map = new L.Map('map').setView([51.505, -0.09], 13);
const tiles = new L.TileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
</script>
L in favor of modern ESMSVG.VML rendererie, ielt9, edge, webkit, android, android23, androidStock, opera, gecko, phantom, opera12, win, ie3d, webkit3d, gecko3d, any3d, mobileWebkit, mobileWebkit3d, msPointer, mobileOpera, mobileGecko, passiveEvents, canvas, svg, vml, inlineSvg, touch, touchNativeL_NO_TOUCH and L_DISABLE_3D are also gonesetPosition and getPosition no longer rely on _leaflet_posgetStyle, testProp, empty, remove, TRANSITION, TRANSITION_END, TRANSFORM, removeClass, setOpacity, addClass, setClass, getClass, hasClassenableTextSelection and disableTextSelection now use standard userSelect style (no vendor prefixes anymore)setTransform drops vendor prefixed style transform tootrim, create, isArray, bind, requestAnimFrame, cancelAnimFrame, extend, getParamString.getMousePosition renamed to getPointerPositiondisableClickPropagation no longer supports mouse and touch eventsgetPropagationPath polyfill for ev.composedPath() removedgetWheelDelta cleaned up from old Firefox/IE quirksDomEvent.Pointer module has been removedaddListener and removeListener have been removedmouseEventToContainerPoint, mouseEventToLayerPoint, mouseEventToLatLng ➜pointerEventToContainerPoint, pointerEventToLayerPoint, pointerEventToLatLngmouse and touch event support (fully replaced by pointer events)ResizeObserver instead of window.onresizearia-keyshortcuts attributebubblingMouseEvents renamed to bubblingPointerEventsClass.__super__(e.which !== 1 && e.button !== 1) ➜ (e.button !== 0)correspondingUseElementfilter CSS property<section> with <fieldset>aria-haspopup for IEcollapseDelayTouchZoom to PinchZoom to better reflect functionalitytouchZoom alias remains for backward compatibilityL.marker(latlng) ➜ new Marker(latlng)Point, LatLng, and Bounds constructors no longer return null for invalid inputsPoint and LatLng now include .validate() methodlayer property — use propagatedFrom insteadmozEvent warning removedaddEventListener, removeEventListener, addOneTimeEventListener, fireEvent, hasEventListenersIconDefault.imagePath is unsetL.circle(latlng, radius, options)dashOffsetcontrolsYou can explore all changes included in this release through the following resources:
Check out this polyfill package to help ease the transition for legacy apps: Leaflet V1 Polyfill
Thanks to everyone who contributed ideas, code, feedback, and testing over the years. This release is a major step forward for Leaflet, and we can’t wait to see what you build with it!
Cheers,
The Leaflet Team