mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-07-25 01:32:21 +00:00
Remove usage of global L and safeguard against it (#8536)
This commit is contained in:

committed by
GitHub

parent
0bfedaebeb
commit
8ae526bab8
5
docs/.eslintrc
Normal file
5
docs/.eslintrc
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"globals": {
|
||||
"L": true
|
||||
}
|
||||
}
|
@ -70,7 +70,6 @@
|
||||
],
|
||||
"root": true,
|
||||
"globals": {
|
||||
"L": true,
|
||||
"globalThis": true
|
||||
},
|
||||
"env": {
|
||||
|
@ -7,6 +7,7 @@
|
||||
"mocha": true
|
||||
},
|
||||
"globals": {
|
||||
"L": true,
|
||||
"expect": false,
|
||||
"sinon": false,
|
||||
"happen": false,
|
||||
|
@ -120,6 +120,7 @@ Class.addInitHook = function (fn) { // (Function) || (String, args...)
|
||||
};
|
||||
|
||||
function checkDeprecatedMixinEvents(includes) {
|
||||
/* global L: true */
|
||||
if (typeof L === 'undefined' || !L || !L.Mixin) { return; }
|
||||
|
||||
includes = Util.isArray(includes) ? includes : [includes];
|
||||
|
@ -1,5 +1,6 @@
|
||||
import * as DomEvent from './DomEvent';
|
||||
import Browser from '../core/Browser';
|
||||
import {falseFn} from '../core/Util';
|
||||
|
||||
/*
|
||||
* Extends L.DomEvent to provide touch support for Internet Explorer and Windows-based devices.
|
||||
@ -33,7 +34,7 @@ export function addPointerListener(obj, type, handler) {
|
||||
}
|
||||
if (!handle[type]) {
|
||||
console.warn('wrong event specified:', type);
|
||||
return L.Util.falseFn;
|
||||
return falseFn;
|
||||
}
|
||||
handler = handle[type].bind(this, handler);
|
||||
obj.addEventListener(pEvent[type], handler, false);
|
||||
|
@ -2,7 +2,7 @@ import {Map} from '../map/Map';
|
||||
import {Layer} from './Layer';
|
||||
import {FeatureGroup} from './FeatureGroup';
|
||||
import * as Util from '../core/Util';
|
||||
import {toLatLng} from '../geo/LatLng';
|
||||
import {toLatLng, LatLng} from '../geo/LatLng';
|
||||
import {toPoint} from '../geometry/Point';
|
||||
import * as DomUtil from '../dom/DomUtil';
|
||||
|
||||
@ -42,7 +42,7 @@ export var DivOverlay = Layer.extend({
|
||||
},
|
||||
|
||||
initialize: function (options, source) {
|
||||
if (options && (options instanceof L.LatLng || Util.isArray(options))) {
|
||||
if (options && (options instanceof LatLng || Util.isArray(options))) {
|
||||
this._latlng = toLatLng(options);
|
||||
Util.setOptions(this, source);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user