jshint fixes and cleanup for uglifyjs2

This commit is contained in:
Vladimir Agafonkin 2012-12-12 19:09:47 +02:00
parent 9fac165906
commit 6134a41554
8 changed files with 22 additions and 33 deletions

View File

@ -1,3 +1,4 @@
L.extend(L.DomEvent, {
_touchstart: L.Browser.msTouch ? 'MSPointerDown' : 'touchstart',
@ -33,7 +34,9 @@ L.extend(L.DomEvent, {
doubleTap = (delta > 0 && delta <= delay);
last = now;
}
function onTouchEnd(e) {
/*jshint forin:false */
if (L.Browser.msTouch) {
var idx = trackedTouches.indexOf(e.pointerId);
if (idx === -1) {
@ -47,14 +50,13 @@ L.extend(L.DomEvent, {
//Work around .type being readonly with MSPointer* events
var newTouch = { },
prop;
for (var i in touch) {
if (true) { //Make JSHint happy, we want to copy all properties
prop = touch[i];
if (typeof prop === 'function') {
newTouch[i] = prop.bind(touch);
} else {
newTouch[i] = prop;
}
prop = touch[i];
if (typeof prop === 'function') {
newTouch[i] = prop.bind(touch);
} else {
newTouch[i] = prop;
}
}
touch = newTouch;

View File

@ -165,9 +165,8 @@ L.DomEvent = {
return (related !== el);
},
/*jshint noarg:false */
_getEvent: function () { // evil magic for IE
/*jshint noarg:false */
var e = window.event;
if (!e) {
var caller = arguments.callee.caller;
@ -181,7 +180,6 @@ L.DomEvent = {
}
return e;
}
/*jshint noarg:false */
};
L.DomEvent.on = L.DomEvent.addListener;

View File

@ -3,6 +3,8 @@
* and polylines (clipping, simplification, distances, etc.)
*/
/*jshint bitwise:false */ // allow bitwise oprations for this file
L.LineUtil = {
// Simplify polyline with vertex reduction and Douglas-Peucker simplification.
@ -94,16 +96,11 @@ L.LineUtil = {
return reducedPoints;
},
/*jshint bitwise:false */ // temporarily allow bitwise oprations
// Cohen-Sutherland line clipping algorithm.
// Used to avoid rendering parts of a polyline that are not currently visible.
clipSegment: function (a, b, bounds, useLastCode) {
var min = bounds.min,
max = bounds.max,
codeA = useLastCode ? this._lastCode : this._getBitCode(a, bounds),
var codeA = useLastCode ? this._lastCode : this._getBitCode(a, bounds),
codeB = this._getBitCode(b, bounds),
codeOut, p, newCode;
@ -169,8 +166,6 @@ L.LineUtil = {
return code;
},
/*jshint bitwise:true */
// square distance (to avoid unnecessary Math.sqrt calls)
_sqDist: function (p1, p2) {
var dx = p2.x - p1.x,

View File

@ -11,9 +11,7 @@ L.PolyUtil = {};
* Used to avoid rendering parts of a polygon that are not currently visible.
*/
L.PolyUtil.clipPolygon = function (points, bounds) {
var min = bounds.min,
max = bounds.max,
clippedPoints,
var clippedPoints,
edges = [1, 4, 2, 8],
i, j, k,
a, b,
@ -55,5 +53,3 @@ L.PolyUtil.clipPolygon = function (points, bounds) {
return points;
};
/*jshint bitwise:true */

View File

@ -244,7 +244,7 @@ L.TileLayer = L.Class.extend({
this._initContainer();
},
_update: function (e) {
_update: function () {
if (!this._map) { return; }
@ -465,9 +465,8 @@ L.TileLayer = L.Class.extend({
return this._createTile();
},
_resetTile: function (tile) {
// Override if data stored on a tile needs to be cleaned up before reuse
},
// Override if data stored on a tile needs to be cleaned up before reuse
_resetTile: function (/*tile*/) {},
_createTile: function () {
var tile = this._tileImg.cloneNode(false);
@ -490,7 +489,7 @@ L.TileLayer = L.Class.extend({
}
},
_tileOnLoad: function (e) {
_tileOnLoad: function () {
var layer = this._layer;
//Only if we are loading an actual image
@ -506,7 +505,7 @@ L.TileLayer = L.Class.extend({
layer._tileLoaded();
},
_tileOnError: function (e) {
_tileOnError: function () {
var layer = this._layer;
layer.fire('tileerror', {

View File

@ -25,7 +25,7 @@ L.Polygon = L.Polyline.extend({
if (!this._holes) { return; }
var i, j, len, len2, hole;
var i, j, len, len2;
for (i = 0, len = this._holes.length; i < len; i++) {
this._holePoints[i] = [];

View File

@ -41,7 +41,7 @@ L.Polyline = L.Path.extend({
return this.redraw();
},
spliceLatLngs: function (index, howMany) {
spliceLatLngs: function () { // (Number index, Number howMany)
var removed = [].splice.apply(this._latlngs, arguments);
this._convertLatLngs(this._latlngs);
this.redraw();

View File

@ -93,8 +93,7 @@ L.Map.Drag = L.Handler.extend({
_onPreDrag: function () {
// TODO refactor to be able to adjust map pane position after zoom
var map = this._map,
worldWidth = this._worldWidth,
var worldWidth = this._worldWidth,
halfWidth = Math.round(worldWidth / 2),
dx = this._initialWorldOffset,
x = this._draggable._newPos.x,