diff --git a/spec/suites/core/EventsSpec.js b/spec/suites/core/EventsSpec.js index 4a28bc2a4..59b56a0c3 100644 --- a/spec/suites/core/EventsSpec.js +++ b/spec/suites/core/EventsSpec.js @@ -634,9 +634,6 @@ describe('Events', () => { expect(spy2.calledWith({ type: 'test2', target: parent, - // layer should be deprecated in the future - // in favor of sourceTarget - layer: obj, sourceTarget: obj, propagatedFrom: obj })).to.be.true; diff --git a/spec/suites/dom/DomEvent.DoubleTapSpec.js b/spec/suites/dom/DomEvent.DoubleTapSpec.js index 97218fa41..093a866cc 100644 --- a/spec/suites/dom/DomEvent.DoubleTapSpec.js +++ b/spec/suites/dom/DomEvent.DoubleTapSpec.js @@ -42,15 +42,6 @@ describe('DomEvent.DoubleTapSpec.js', () => { expect(spy.notCalled).to.be.true; }); - it('does not fire dblclick when detail !== 1', () => { - UIEventSimulator.fire('click', container, {detail: 0}); // like in IE - clock.tick(100); - UIEventSimulator.fire('click', container, {detail: 0}); - clock.tick(100); - - expect(spy.notCalled).to.be.true; - }); - it('does not fire dblclick after removeListener', () => { DomEvent.off(container, 'dblclick', spy); diff --git a/spec/suites/dom/DomEventSpec.js b/spec/suites/dom/DomEventSpec.js index c993d1581..1c9845299 100644 --- a/spec/suites/dom/DomEventSpec.js +++ b/spec/suites/dom/DomEventSpec.js @@ -599,20 +599,13 @@ describe('DomEvent', () => { }); describe('#preventDefault', () => { - function isPrevented(e) { - if ('defaultPrevented' in e) { - return e.defaultPrevented; - } - return !e.returnValue; // IE<11 - } - it('prevents the default action of event', (done) => { DomEvent.on(el, 'click', (e) => { - expect(isPrevented(e)).not.to.be.true; // control case + expect(e.defaultPrevented).not.to.be.true; // control case DomEvent.preventDefault(e); - expect(isPrevented(e)).to.be.true; + expect(e.defaultPrevented).to.be.true; done(); }); diff --git a/spec/suites/layer/GeoJSONSpec.js b/spec/suites/layer/GeoJSONSpec.js index f5f35f068..8f912665f 100644 --- a/spec/suites/layer/GeoJSONSpec.js +++ b/spec/suites/layer/GeoJSONSpec.js @@ -154,7 +154,7 @@ describe('Marker#toGeoJSON', () => { describe('Circle#toGeoJSON', () => { it('returns a 2D Point object', () => { - const circle = new Circle([10, 20], 100); + const circle = new Circle([10, 20], {radius: 100}); expect(circle.toGeoJSON().geometry).to.eql({ type: 'Point', coordinates: [20, 10] @@ -162,7 +162,7 @@ describe('Circle#toGeoJSON', () => { }); it('returns a 3D Point object', () => { - const circle = new Circle([10, 20, 30], 100); + const circle = new Circle([10, 20, 30], {radius: 100}); expect(circle.toGeoJSON().geometry).to.eql({ type: 'Point', coordinates: [20, 10, 30] @@ -170,7 +170,7 @@ describe('Circle#toGeoJSON', () => { }); it('should allow specific precisions', () => { - const circle = new Circle([10.1234, 20.1234, 30.1234], 100); + const circle = new Circle([10.1234, 20.1234, 30.1234], {radius: 100}); expect(circle.toGeoJSON(3).geometry).to.eql({ type: 'Point', coordinates: [20.123, 10.123, 30.123] diff --git a/spec/suites/layer/ImageOverlaySpec.js b/spec/suites/layer/ImageOverlaySpec.js index af8da2af3..d550d4dbf 100644 --- a/spec/suites/layer/ImageOverlaySpec.js +++ b/spec/suites/layer/ImageOverlaySpec.js @@ -110,23 +110,23 @@ describe('ImageOverlay', () => { it('should update the z-index of the image if it has allready been added to the map', () => { const overlay = imageOverlay('', imageBounds); overlay.addTo(map); - expect(overlay._image.style.zIndex).to.eql('1'); // Number type in IE + expect(overlay._image.style.zIndex).to.eql('1'); overlay.setZIndex('10'); - expect(overlay._image.style.zIndex).to.eql('10'); // Number type in IE + expect(overlay._image.style.zIndex).to.eql('10'); }); it('should set the z-index of the image when it is added to the map', () => { const overlay = imageOverlay('', imageBounds); overlay.setZIndex('10'); overlay.addTo(map); - expect(overlay._image.style.zIndex).to.eql('10'); // Number type in IE + expect(overlay._image.style.zIndex).to.eql('10'); }); it('should use the z-index specified in options', () => { const overlay = imageOverlay('', imageBounds, {zIndex: 20}); overlay.addTo(map); - expect(overlay._image.style.zIndex).to.eql('20'); // Number type in IE + expect(overlay._image.style.zIndex).to.eql('20'); }); it('should be fluent', () => { diff --git a/spec/suites/layer/PopupSpec.js b/spec/suites/layer/PopupSpec.js index 6ee060822..c919ddf67 100644 --- a/spec/suites/layer/PopupSpec.js +++ b/spec/suites/layer/PopupSpec.js @@ -103,7 +103,7 @@ describe('Popup', () => { // toggle popup on marker1 group.fire('click', { latlng: center, - layer: marker1 + propagatedFrom: marker1 }); expect(map.hasLayer(group._popup)).to.be.true; expect(group._popup._contentNode.innerHTML).to.equal('I\'m marker 1.'); @@ -111,7 +111,7 @@ describe('Popup', () => { // toggle popup on marker2 group.fire('click', { latlng: [54.6, 38.2], - layer: marker2 + propagatedFrom: marker2 }); expect(map.hasLayer(group._popup)).to.be.true; expect(group._popup._contentNode.innerHTML).to.equal('I\'m marker 2.'); @@ -133,7 +133,7 @@ describe('Popup', () => { // toggle popup on marker1 group.fire('click', { latlng: center, - layer: marker1 + propagatedFrom: marker1 }); expect(map.hasLayer(group._popup)).to.be.true; expect(group._popup._contentNode.innerHTML).to.equal('I\'m marker 1.'); @@ -141,7 +141,7 @@ describe('Popup', () => { // toggle popup on marker2 group.fire('click', { latlng: [54.6, 38.2], - layer: marker2 + propagatedFrom: marker2 }); expect(map.hasLayer(group._popup)).to.be.true; expect(group._popup._contentNode.innerHTML).to.equal('I\'m marker 2.'); diff --git a/spec/suites/layer/VideoOverlaySpec.js b/spec/suites/layer/VideoOverlaySpec.js index b4cd7a6ba..010de3270 100644 --- a/spec/suites/layer/VideoOverlaySpec.js +++ b/spec/suites/layer/VideoOverlaySpec.js @@ -17,10 +17,7 @@ describe('VideoOverlay', () => { removeMapContainer(map, container); }); - - it('create VideoOverlay', function () { - this.timeout(10000); // This test takes longer than usual in IE - + it('create VideoOverlay', () => { const videoUrls = [ 'https://www.mapbox.com/bites/00188/patricia_nasa.webm', 'https://www.mapbox.com/bites/00188/patricia_nasa.mp4' diff --git a/spec/suites/layer/marker/Icon.DefaultSpec.js b/spec/suites/layer/marker/Icon.DefaultSpec.js index 82866a8d1..9ba59fec6 100644 --- a/spec/suites/layer/marker/Icon.DefaultSpec.js +++ b/spec/suites/layer/marker/Icon.DefaultSpec.js @@ -33,7 +33,7 @@ describe('Icon.Default', () => { [ // valid 'url("http://localhost:8000/base/dist/images/marker-icon.png")', // Firefox 'url(\'http://localhost:8000/base/dist/images/marker-icon.png\')', - 'url(http://localhost:8000/base/dist/images/marker-icon.png)', // IE, Edge + 'url(http://localhost:8000/base/dist/images/marker-icon.png)' ].map(stripUrl).forEach((str) => { expect(str).to.equal(properPath); }); [ // invalid diff --git a/spec/suites/layer/tile/TileLayerSpec.js b/spec/suites/layer/tile/TileLayerSpec.js index 3bdd3a4a2..27a6a516c 100644 --- a/spec/suites/layer/tile/TileLayerSpec.js +++ b/spec/suites/layer/tile/TileLayerSpec.js @@ -1,5 +1,5 @@ import {expect} from 'chai'; -import {Browser, CRS, DomUtil, Map, TileLayer, Util, LatLng} from 'leaflet'; +import {Browser, CRS, Map, TileLayer, Util, LatLng} from 'leaflet'; import sinon from 'sinon'; import {createContainer, removeMapContainer} from '../../SpecHelper.js'; @@ -442,8 +442,7 @@ describe('TileLayer', () => { }); }); - const _describe = 'crossOrigin' in DomUtil.create('img') ? describe : describe.skip; // skip in IE<11 - _describe('crossOrigin option', () => { + describe('crossOrigin option', () => { beforeEach(() => { map.setView([0, 0], 2); }); diff --git a/spec/suites/layer/vector/CircleSpec.js b/spec/suites/layer/vector/CircleSpec.js index 944f8c99a..8045208fc 100644 --- a/spec/suites/layer/vector/CircleSpec.js +++ b/spec/suites/layer/vector/CircleSpec.js @@ -21,13 +21,6 @@ describe('Circle', () => { const circle = new Circle([0, 0]); expect(circle.getRadius()).to.eql(10); }); - - it('throws error if radius is NaN', () => { - expect(() => { - new Circle([0, 0], NaN); - }).to.throw('Circle radius cannot be NaN'); - }); - }); describe('#getBounds', () => { diff --git a/src/control/Control.Layers.js b/src/control/Control.Layers.js index e701e3be1..b0421c2fa 100644 --- a/src/control/Control.Layers.js +++ b/src/control/Control.Layers.js @@ -188,9 +188,6 @@ export const Layers = Control.extend({ container = this._container = DomUtil.create('div', className), collapsed = this.options.collapsed; - // makes this work on IE touch devices by stopping it from firing a mouseout event when the touch is released - container.setAttribute('aria-haspopup', true); - DomEvent.disableClickPropagation(container); DomEvent.disableScrollPropagation(container); diff --git a/src/core/Events.js b/src/core/Events.js index 97882d704..9d48b944c 100644 --- a/src/core/Events.js +++ b/src/core/Events.js @@ -296,7 +296,6 @@ export const Events = { _propagateEvent(e) { for (const p of Object.values(this._eventParents ?? {})) { p.fire(e.type, { - layer: e.target, propagatedFrom: e.target, ...e }, true); diff --git a/src/core/Events.leafdoc b/src/core/Events.leafdoc index c4d335dc5..966ce36bf 100644 --- a/src/core/Events.leafdoc +++ b/src/core/Events.leafdoc @@ -29,8 +29,6 @@ be the same as the `target`. @property propagatedFrom: Object For propagated events, the last object that propagated the event to its event parent. -@property layer: Object -**Deprecated.** The same as `propagatedFrom`. @miniclass KeyboardEvent (Event objects) diff --git a/src/dom/DomEvent.js b/src/dom/DomEvent.js index 5df8f3cb6..52b83215e 100644 --- a/src/dom/DomEvent.js +++ b/src/dom/DomEvent.js @@ -219,22 +219,10 @@ export function stop(e) { } // @function getPropagationPath(ev: DOMEvent): Array -// Compatibility polyfill for [`Event.composedPath()`](https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath). // Returns an array containing the `HTMLElement`s that the given DOM event // should propagate to (if not stopped). export function getPropagationPath(ev) { - if (ev.composedPath) { - return ev.composedPath(); - } - - const path = []; - let el = ev.target; - - while (el) { - path.push(el); - el = el.parentNode; - } - return path; + return ev.composedPath(); } @@ -278,9 +266,6 @@ export function getWheelDelta(e) { (e.deltaY && e.deltaMode === 1) ? -e.deltaY * 20 : // Lines (e.deltaY && e.deltaMode === 2) ? -e.deltaY * 60 : // Pages (e.deltaX || e.deltaZ) ? 0 : // Skip horizontal/depth wheel events - e.wheelDelta ? (e.wheelDeltaY || e.wheelDelta) / 2 : // Legacy IE pixels - (e.detail && Math.abs(e.detail) < 32765) ? -e.detail * 20 : // Legacy Moz lines - e.detail ? e.detail / -32765 * 60 : // Legacy Moz pages 0; } diff --git a/src/dom/Draggable.js b/src/dom/Draggable.js index ff18add37..bd58b33e9 100644 --- a/src/dom/Draggable.js +++ b/src/dom/Draggable.js @@ -154,11 +154,6 @@ export const Draggable = Evented.extend({ document.body.classList.add('leaflet-dragging'); this._lastTarget = e.target ?? e.srcElement; - // IE and Edge do not give the element, so fetch it - // if necessary - if (window.SVGElementInstance && this._lastTarget instanceof window.SVGElementInstance) { - this._lastTarget = this._lastTarget.correspondingUseElement; - } this._lastTarget.classList.add('leaflet-drag-target'); } diff --git a/src/geo/crs/CRS.EPSG4326.js b/src/geo/crs/CRS.EPSG4326.js index 1564fa505..5bd198188 100644 --- a/src/geo/crs/CRS.EPSG4326.js +++ b/src/geo/crs/CRS.EPSG4326.js @@ -8,9 +8,8 @@ import {toTransformation} from '../../geometry/Transformation.js'; * * A common CRS among GIS enthusiasts. Uses simple Equirectangular projection. * - * Leaflet 1.0.x complies with the [TMS coordinate scheme for EPSG:4326](https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-geodetic), - * which is a breaking change from 0.7.x behaviour. If you are using a `TileLayer` - * with this CRS, ensure that there are two 256x256 pixel tiles covering the + * Leaflet complies with the [TMS coordinate scheme for EPSG:4326](https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-geodetic). + * If you are using a `TileLayer` with this CRS, ensure that there are two 256x256 pixel tiles covering the * whole earth at zoom level zero, and that the tile coordinate origin is (-180,+90), * or (-180,-90) for `TileLayer`s with [the `tms` option](#tilelayer-tms) set. */ diff --git a/src/layer/Popup.js b/src/layer/Popup.js index c25b97f94..f3d86067c 100644 --- a/src/layer/Popup.js +++ b/src/layer/Popup.js @@ -500,7 +500,7 @@ Layer.include({ // prevent map click DomEvent.stop(e); - const target = e.layer ?? e.target; + const target = e.propagatedFrom ?? e.target; if (this._popup._source === target && !(target instanceof Path)) { // treat it like a marker and figure out // if we should toggle it open/closed diff --git a/src/layer/Tooltip.js b/src/layer/Tooltip.js index 3a79f4bbc..9ca64574e 100644 --- a/src/layer/Tooltip.js +++ b/src/layer/Tooltip.js @@ -444,7 +444,7 @@ Layer.include({ return; } - this._tooltip._source = e.layer ?? e.target; + this._tooltip._source = e.propagatedFrom ?? e.target; this.openTooltip(this._tooltip.options.sticky ? e.latlng : undefined); }, diff --git a/src/layer/marker/Icon.Default.js b/src/layer/marker/Icon.Default.js index c27100b12..8091e10ec 100644 --- a/src/layer/marker/Icon.Default.js +++ b/src/layer/marker/Icon.Default.js @@ -31,7 +31,8 @@ export const IconDefault = Icon.extend({ }, _getIconUrl(name) { - if (typeof IconDefault.imagePath !== 'string') { // Deprecated, backwards-compatibility only + // only detect once + if (!IconDefault.imagePath) { IconDefault.imagePath = this._detectIconPath(); } diff --git a/src/layer/vector/Circle.js b/src/layer/vector/Circle.js index 658e4d261..296dd35e5 100644 --- a/src/layer/vector/Circle.js +++ b/src/layer/vector/Circle.js @@ -24,11 +24,7 @@ import {Earth} from '../../geo/crs/CRS.Earth.js'; export const Circle = CircleMarker.extend({ - initialize(latlng, options, legacyOptions) { - if (typeof options === 'number') { - // Backwards compatibility with 0.7.x factory (latlng, radius, options?) - options = {...legacyOptions, radius: options}; - } + initialize(latlng, options) { Util.setOptions(this, options); this._latlng = toLatLng(latlng); @@ -104,10 +100,6 @@ export const Circle = CircleMarker.extend({ // @factory L.circle(latlng: LatLng, options?: Circle options) // Instantiates a circle object given a geographical point, and an options object // which contains the circle radius. -// @alternative -// @factory L.circle(latlng: LatLng, radius: Number, options?: Circle options) -// Obsolete way of instantiating a circle, for compatibility with 0.7.x code. -// Do not use in new applications or plugins. export function circle(latlng, options, legacyOptions) { return new Circle(latlng, options, legacyOptions); }