Skip to content

Commit 81221ae

Browse files
committed
fix jshint 1.1.0 errors, update deps and build
1 parent b317954 commit 81221ae

File tree

7 files changed

+53
-19
lines changed

7 files changed

+53
-19
lines changed

build/build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function lintFiles(files) {
1212

1313
for (i = 0, len = files.length; i < len; i++) {
1414

15-
jshint.JSHINT(fs.readFileSync(files[i], 'utf8'), hintrc);
15+
jshint.JSHINT(fs.readFileSync(files[i], 'utf8'), hintrc, i ? {L: true} : null);
1616
errors = jshint.JSHINT.errors;
1717

1818
for (j = 0, len2 = errors.length; j < len2; j++) {

build/hintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
exports.config = {
22
"browser": true,
33
"node": true,
4-
"predef": ["L"],
4+
"predef": [],
55

66
"debug": false,
77
"devel": false,

dist/leaflet-src.js

+41-7
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
471471
ua = navigator.userAgent.toLowerCase(),
472472
webkit = ua.indexOf('webkit') !== -1,
473473
chrome = ua.indexOf('chrome') !== -1,
474+
phantomjs = ua.indexOf('phantom') !== -1,
474475
android = ua.indexOf('android') !== -1,
475476
android23 = ua.search('android [23]') !== -1,
476477

@@ -486,7 +487,7 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
486487
webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()),
487488
gecko3d = 'MozPerspective' in doc.style,
488489
opera3d = 'OTransition' in doc.style,
489-
any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d || opera3d);
490+
any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d || opera3d) && !phantomjs;
490491

491492

492493
var touch = !window.L_NO_TOUCH && (function () {
@@ -951,7 +952,12 @@ L.DomUtil = {
951952
filterName = 'DXImageTransform.Microsoft.Alpha';
952953

953954
// filters collection throws an error if we try to retrieve a filter that doesn't exist
954-
try { filter = el.filters.item(filterName); } catch (e) {}
955+
try {
956+
filter = el.filters.item(filterName);
957+
} catch (e) {
958+
//Don't set opacity to 1 if we haven't already set an opacity, it isn't needed and breaks transparent pngs.
959+
if (value === 1) { return; }
960+
}
955961

956962
value = Math.round(value * 100);
957963

@@ -3284,6 +3290,10 @@ L.Marker = L.Class.extend({
32843290
},
32853291

32863292
onRemove: function (map) {
3293+
if (this.dragging) {
3294+
this.dragging.disable();
3295+
}
3296+
32873297
this._removeIcon();
32883298

32893299
this.fire('remove');
@@ -4021,6 +4031,16 @@ L.LayerGroup = L.Class.extend({
40214031
return this;
40224032
},
40234033

4034+
getLayers: function () {
4035+
var layers = [];
4036+
for (var i in this._layers) {
4037+
if (this._layers.hasOwnProperty(i)) {
4038+
layers.push(this._layers[i]);
4039+
}
4040+
}
4041+
return layers;
4042+
},
4043+
40244044
setZIndex: function (zIndex) {
40254045
return this.invoke('setZIndex', zIndex);
40264046
}
@@ -5290,11 +5310,20 @@ L.Polygon = L.Polyline.extend({
52905310
},
52915311

52925312
initialize: function (latlngs, options) {
5313+
var i, len, hole;
5314+
52935315
L.Polyline.prototype.initialize.call(this, latlngs, options);
52945316

52955317
if (latlngs && L.Util.isArray(latlngs[0]) && (typeof latlngs[0][0] !== 'number')) {
52965318
this._latlngs = this._convertLatLngs(latlngs[0]);
52975319
this._holes = latlngs.slice(1);
5320+
5321+
for (i = 0, len = this._holes.length; i < len; i++) {
5322+
hole = this._holes[i] = this._convertLatLngs(this._holes[i]);
5323+
if (hole[0].equals(hole[hole.length - 1])) {
5324+
hole.pop();
5325+
}
5326+
}
52985327
}
52995328

53005329
// filter out last point if its equal to the first one
@@ -5550,7 +5579,7 @@ L.CircleMarker = L.Circle.extend({
55505579
projectLatlngs: function () {
55515580
this._point = this._map.latLngToLayerPoint(this._latlng);
55525581
},
5553-
5582+
55545583
_updateStyle : function () {
55555584
L.Circle.prototype._updateStyle.call(this);
55565585
this.setRadius(this.options.radius);
@@ -5881,7 +5910,7 @@ L.DomEvent = {
58815910
key = '_leaflet_' + type + id,
58825911
handler = obj[key];
58835912

5884-
if (!handler) { return; }
5913+
if (!handler) { return this; }
58855914

58865915
if (L.Browser.msTouch && type.indexOf('touch') === 0) {
58875916
this.removeMsTouchListener(obj, type, id);
@@ -7132,6 +7161,11 @@ L.Handler.MarkerDrag = L.Handler.extend({
71327161
},
71337162

71347163
removeHooks: function () {
7164+
this._draggable
7165+
.off('dragstart', this._onDragStart)
7166+
.off('drag', this._onDrag)
7167+
.off('dragend', this._onDragEnd);
7168+
71357169
this._draggable.disable();
71367170
},
71377171

@@ -7950,9 +7984,9 @@ L.Map.include({
79507984
if (canBeAnimated) {
79517985

79527986
// try animating pan or zoom
7953-
var animated = zoomChanged && this.options.zoomAnimation ?
7954-
this._animateZoomIfClose && this._animateZoomIfClose(center, zoom) :
7955-
this._animatePanIfClose(center);
7987+
var animated = zoomChanged ?
7988+
this.options.zoomAnimation && this._animateZoomIfClose && this._animateZoomIfClose(center, zoom) :
7989+
this._animatePanIfClose(center);
79567990

79577991
if (animated) {
79587992
// prevent resize handler call, the view will refresh after animation anyway

dist/leaflet.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"version": "0.6.0",
44
"description": "JavaScript library for mobile-friendly interactive maps",
55
"devDependencies": {
6-
"jshint": "~0.9.1",
7-
"testacular": "latest",
8-
"uglify-js": "~2.2.3",
9-
"jake": "latest"
6+
"jshint": "~1.1.0",
7+
"testacular": "~0.6.0",
8+
"uglify-js": "~2.2.5",
9+
"jake": "~0.5.8"
1010
},
1111
"main": "dist/leaflet.js",
1212
"scripts": {

src/layer/marker/Marker.Drag.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ L.Handler.MarkerDrag = L.Handler.extend({
2323
.off('dragstart', this._onDragStart)
2424
.off('drag', this._onDrag)
2525
.off('dragend', this._onDragEnd);
26-
26+
2727
this._draggable.disable();
2828
},
2929

src/layer/vector/CircleMarker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ L.CircleMarker = L.Circle.extend({
1616
projectLatlngs: function () {
1717
this._point = this._map.latLngToLayerPoint(this._latlng);
1818
},
19-
19+
2020
_updateStyle : function () {
2121
L.Circle.prototype._updateStyle.call(this);
2222
this.setRadius(this.options.radius);

0 commit comments

Comments
 (0)