jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/351593 )
Change subject: Never create a local variable called "Map"
......................................................................
Never create a local variable called "Map"
"Map" is a native function/class in ES6.
Change-Id: I0db3ad49e08afeb164a11d3bebe0d1dff83949f8
---
M modules/box/Map.js
M modules/wikivoyage/WVMap.js
2 files changed, 13 insertions(+), 11 deletions(-)
Approvals:
jenkins-bot: Verified
Jforrester: Looks good to me, approved
diff --git a/modules/box/Map.js b/modules/box/Map.js
index 7309392..cd83424 100644
--- a/modules/box/Map.js
+++ b/modules/box/Map.js
@@ -4,6 +4,8 @@
*
* Creates a map with layers, markers, and interactivity.
*
+ * Avoid creating a local variable "Map" as this is a native function in ES6.
+ *
* @alias KartographerMap
* @class Kartographer.Box.MapClass
* @extends L.Map
@@ -13,7 +15,7 @@
var scale, urlFormat,
mapServer = mw.config.get( 'wgKartographerMapServer' ),
worldLatLng = new L.LatLngBounds( [ -90, -180 ], [ 90, 180 ] ),
- Map,
+ KartographerMap,
precisionPerZoom = [ 0, 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4,
4, 4, 4, 5, 5 ],
inlineDataLayerKey = 'kartographer-inline-data-layer',
inlineDataLayerId = 0;
@@ -105,7 +107,7 @@
return layerBounds;
}
- Map = L.Map.extend( {
+ KartographerMap = L.Map.extend( {
/**
* @constructor
* @param {Object} options **Configuration and options:**
@@ -497,7 +499,7 @@
);
} );
} else {
- map = this.fullScreenMap = new Map( {
+ map = this.fullScreenMap = new
KartographerMap( {
container: L.DomUtil.create(
'div', 'mw-kartographer-mapDialog-map' ),
center: position.center,
zoom: position.zoom,
@@ -842,7 +844,7 @@
}
} );
- return Map;
+ return KartographerMap;
}(
mediaWiki,
module.OpenFullScreenControl,
@@ -853,8 +855,8 @@
window
) );
-module.map = ( function ( Map ) {
+module.map = ( function ( KartographerMap ) {
return function ( options ) {
- return new Map( options );
+ return new KartographerMap( options );
};
}( module.Map ) );
diff --git a/modules/wikivoyage/WVMap.js b/modules/wikivoyage/WVMap.js
index c44729e..46a6258 100644
--- a/modules/wikivoyage/WVMap.js
+++ b/modules/wikivoyage/WVMap.js
@@ -8,7 +8,7 @@
module.WVMap = ( function ( $, mw, wikivoyage, WVMapLayers, ControlNearby ) {
/* eslint-disable no-underscore-dangle */
- var Map = function ( map ) {
+ var WVMap = function ( map ) {
this.map = map;
};
@@ -17,7 +17,7 @@
*
* @return {Kartographer.Wikivoyage.ControlNearby}
*/
- Map.prototype.nearby = function () {
+ WVMap.prototype.nearby = function () {
var control = this._controlNearby;
if ( control ) {
return control;
@@ -40,7 +40,7 @@
*
* @return {Kartographer.Wikivoyage.WVMapLayers}
*/
- Map.prototype.controlLayers = function () {
+ WVMap.prototype.controlLayers = function () {
this._controlLayers = this._controlLayers || new WVMapLayers(
this.map );
return this._controlLayers;
};
@@ -48,11 +48,11 @@
/**
* Adds the scale control to the map.
*/
- Map.prototype.scale = function () {
+ WVMap.prototype.scale = function () {
mw.log( 'Map scale is now added by default on all maps. Please
remove the call to `.scale()`.' );
};
- return Map;
+ return WVMap;
}(
jQuery,
--
To view, visit https://gerrit.wikimedia.org/r/351593
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0db3ad49e08afeb164a11d3bebe0d1dff83949f8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits