Merge pull request #1893 from twpayne/jshint-clean-ups

Check with JSHint
This commit is contained in:
Tom Payne
2014-03-25 17:04:14 +01:00
20 changed files with 131 additions and 79 deletions

View File

@@ -66,7 +66,7 @@ ol.coordinate.closestOnSegment = function(coordinate, segment) {
var y2 = end[1];
var dx = x2 - x1;
var dy = y2 - y1;
var along = (dx == 0 && dy == 0) ? 0 :
var along = (dx === 0 && dy === 0) ? 0 :
((dx * (x0 - x1)) + (dy * (y0 - y1))) / ((dx * dx + dy * dy) || 0);
var x, y;
if (along <= 0) {

View File

@@ -1632,9 +1632,10 @@ ol.format.GML.GEOMETRY_NODE_FACTORY_ = function(value, objectStack,
var multiCurve = goog.object.get(context, 'multiCurve');
var parentNode = objectStack[objectStack.length - 1].node;
goog.asserts.assert(ol.xml.isNode(parentNode));
var nodeName;
if (!goog.isArray(value)) {
goog.asserts.assertInstanceof(value, ol.geom.Geometry);
var nodeName = value.getType();
nodeName = value.getType();
if (nodeName === 'MultiPolygon' && multiSurface === true) {
nodeName = 'MultiSurface';
} else if (nodeName === 'Polygon' && surface === true) {

View File

@@ -490,6 +490,7 @@ ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) {
ol.xml.setAttributeNS(node, null, 'lat', coordinate[1]);
ol.xml.setAttributeNS(node, null, 'lon', coordinate[0]);
var geometryLayout = goog.object.get(context, 'geometryLayout');
/* jshint -W086 */
switch (geometryLayout) {
case ol.geom.GeometryLayout.XYZM:
if (coordinate[3] !== 0) {
@@ -505,6 +506,7 @@ ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) {
goog.object.set(properties, 'time', coordinate[2]);
}
}
/* jshint +W086 */
var orderedKeys = ol.format.GPX.WPT_TYPE_SEQUENCE_[namespaceURI];
var values = ol.xml.makeSequence(properties, orderedKeys);
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */

View File

@@ -1265,7 +1265,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
Array.prototype.push.apply(
this.postRenderFunctions_, frameState.postRenderFunctions);
var idle = this.preRenderFunctions_.length == 0 &&
var idle = this.preRenderFunctions_.length === 0 &&
!frameState.animate &&
!frameState.viewHints[ol.ViewHint.ANIMATING] &&
!frameState.viewHints[ol.ViewHint.INTERACTING];

View File

@@ -323,7 +323,7 @@ ol.MapBrowserEventHandler.prototype.isMouseActionButton_ =
if (ol.LEGACY_IE_SUPPORT && ol.IS_LEGACY_IE) {
return pointerEvent.button == 1;
} else {
return pointerEvent.button == 0;
return pointerEvent.button === 0;
}
};

View File

@@ -193,9 +193,9 @@ ol.pointer.TouchSource.prototype.touchToPointer_ =
e.detail = this.clickCount_;
e.button = 0;
e.buttons = 1;
e.width = inTouch['webkitRadiusX'] || inTouch['radiusX'] || 0;
e.height = inTouch['webkitRadiusY'] || inTouch['radiusY'] || 0;
e.pressure = inTouch['webkitForce'] || inTouch['force'] || 0.5;
e.width = inTouch.webkitRadiusX || inTouch.radiusX || 0;
e.height = inTouch.webkitRadiusY || inTouch.radiusY || 0;
e.pressure = inTouch.webkitForce || inTouch.force || 0.5;
e.isPrimary = this.isPrimaryTouch_(inTouch);
e.pointerType = ol.pointer.TouchSource.POINTER_TYPE;

View File

@@ -272,7 +272,9 @@ ol.source.ImageWMS.prototype.getRequestUrl_ =
params[this.v13_ ? 'CRS' : 'SRS'] = projection.getCode();
if (!('STYLES' in this.params_)) {
/* jshint -W053 */
goog.object.set(params, 'STYLES', new String(''));
/* jshint +W053 */
}
if (pixelRatio != 1) {

View File

@@ -237,7 +237,9 @@ ol.source.TileWMS.prototype.getRequestUrl_ =
params[this.v13_ ? 'CRS' : 'SRS'] = projection.getCode();
if (!('STYLES' in this.params_)) {
/* jshint -W053 */
goog.object.set(params, 'STYLES', new String(''));
/* jshint +W053 */
}
if (pixelRatio != 1) {

View File

@@ -243,6 +243,8 @@ ol.source.WMTS.prototype.updateDimensions = function(dimensions) {
*/
ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, layer) {
/* jshint -W069 */
// TODO: add support for TileMatrixLimits
var layers = wmtsCap['contents']['layers'];
@@ -328,4 +330,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, layer) {
style: style,
dimensions: dimensions
};
/* jshint +W069 */
};