diff --git a/src/ol/color/color.js b/src/ol/color/color.js index 105fe5e387..35c362e731 100644 --- a/src/ol/color/color.js +++ b/src/ol/color/color.js @@ -106,7 +106,7 @@ ol.color.asArray = function(color) { if (goog.isArray(color)) { return color; } else { - goog.asserts.assert(goog.isString(color), 'Color should be a string'); + goog.asserts.assert(typeof color === 'string', 'Color should be a string'); return ol.color.fromString(color); } }; @@ -119,7 +119,7 @@ ol.color.asArray = function(color) { * @api */ ol.color.asString = function(color) { - if (goog.isString(color)) { + if (typeof color === 'string') { return color; } else { goog.asserts.assert(goog.isArray(color), 'Color should be an array'); @@ -322,10 +322,10 @@ ol.color.stringOrColorEquals = function(color1, color2) { if (color1 === color2 || color1 == color2) { return true; } - if (goog.isString(color1)) { + if (typeof color1 === 'string') { color1 = ol.color.fromString(color1); } - if (goog.isString(color2)) { + if (typeof color2 === 'string') { color2 = ol.color.fromString(color2); } return ol.color.equals(color1, color2); diff --git a/src/ol/control/attributioncontrol.js b/src/ol/control/attributioncontrol.js index d583bbfca8..7795f29cfa 100644 --- a/src/ol/control/attributioncontrol.js +++ b/src/ol/control/attributioncontrol.js @@ -74,7 +74,7 @@ ol.control.Attribution = function(opt_options) { * @private * @type {Node} */ - this.collapseLabel_ = goog.isString(collapseLabel) ? + this.collapseLabel_ = typeof collapseLabel === 'string' ? goog.dom.createDom('SPAN', {}, collapseLabel) : collapseLabel; @@ -84,7 +84,7 @@ ol.control.Attribution = function(opt_options) { * @private * @type {Node} */ - this.label_ = goog.isString(label) ? + this.label_ = typeof label === 'string' ? goog.dom.createDom('SPAN', {}, label) : label; diff --git a/src/ol/control/fullscreencontrol.js b/src/ol/control/fullscreencontrol.js index af7a210437..0086d93339 100644 --- a/src/ol/control/fullscreencontrol.js +++ b/src/ol/control/fullscreencontrol.js @@ -45,7 +45,7 @@ ol.control.FullScreen = function(opt_options) { * @private * @type {Node} */ - this.labelNode_ = goog.isString(label) ? + this.labelNode_ = typeof label === 'string' ? document.createTextNode(label) : label; var labelActive = options.labelActive ? options.labelActive : '\u00d7'; @@ -54,7 +54,7 @@ ol.control.FullScreen = function(opt_options) { * @private * @type {Node} */ - this.labelActiveNode_ = goog.isString(labelActive) ? + this.labelActiveNode_ = typeof labelActive === 'string' ? document.createTextNode(labelActive) : labelActive; var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen'; diff --git a/src/ol/control/overviewmapcontrol.js b/src/ol/control/overviewmapcontrol.js index 33e4a6a6d5..f050779dc9 100644 --- a/src/ol/control/overviewmapcontrol.js +++ b/src/ol/control/overviewmapcontrol.js @@ -62,7 +62,7 @@ ol.control.OverviewMap = function(opt_options) { * @private * @type {Node} */ - this.collapseLabel_ = goog.isString(collapseLabel) ? + this.collapseLabel_ = typeof collapseLabel === 'string' ? goog.dom.createDom('SPAN', {}, collapseLabel) : collapseLabel; @@ -72,7 +72,7 @@ ol.control.OverviewMap = function(opt_options) { * @private * @type {Node} */ - this.label_ = goog.isString(label) ? + this.label_ = typeof label === 'string' ? goog.dom.createDom('SPAN', {}, label) : label; diff --git a/src/ol/control/rotatecontrol.js b/src/ol/control/rotatecontrol.js index 127a22c97d..38e1375bde 100644 --- a/src/ol/control/rotatecontrol.js +++ b/src/ol/control/rotatecontrol.js @@ -36,7 +36,7 @@ ol.control.Rotate = function(opt_options) { */ this.label_ = null; - if (goog.isString(label)) { + if (typeof label === 'string') { this.label_ = goog.dom.createDom('SPAN', 'ol-compass', label); } else { diff --git a/src/ol/events/eventtarget.js b/src/ol/events/eventtarget.js index 3f7b6fcb36..b103a25e8c 100644 --- a/src/ol/events/eventtarget.js +++ b/src/ol/events/eventtarget.js @@ -59,7 +59,7 @@ ol.events.EventTarget.prototype.addEventListener = function(type, listener) { * event object or if any of the listeners returned false. */ ol.events.EventTarget.prototype.dispatchEvent = function(event) { - var evt = goog.isString(event) ? new ol.events.Event(event) : event; + var evt = typeof event === 'string' ? new ol.events.Event(event) : event; var type = evt.type; evt.target = this; var listeners = this.listeners_[type]; diff --git a/src/ol/format/gml/gmlbaseformat.js b/src/ol/format/gml/gmlbaseformat.js index 77cd3aeb9f..b80a47935b 100644 --- a/src/ol/format/gml/gmlbaseformat.js +++ b/src/ol/format/gml/gmlbaseformat.js @@ -143,7 +143,7 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) { context['featureType'] = featureType; context['featureNS'] = featureNS; } - if (goog.isString(featureNS)) { + if (typeof featureNS === 'string') { var ns = featureNS; featureNS = {}; featureNS[defaultPrefix] = ns; diff --git a/src/ol/format/jsonfeatureformat.js b/src/ol/format/jsonfeatureformat.js index a967b745e9..331d41409c 100644 --- a/src/ol/format/jsonfeatureformat.js +++ b/src/ol/format/jsonfeatureformat.js @@ -29,7 +29,7 @@ goog.inherits(ol.format.JSONFeature, ol.format.Feature); ol.format.JSONFeature.prototype.getObject_ = function(source) { if (goog.isObject(source)) { return source; - } else if (goog.isString(source)) { + } else if (typeof source === 'string') { var object = goog.json.parse(source); return object ? object : null; } else { diff --git a/src/ol/format/kmlformat.js b/src/ol/format/kmlformat.js index 79af2fa670..a8eebea2a7 100644 --- a/src/ol/format/kmlformat.js +++ b/src/ol/format/kmlformat.js @@ -431,7 +431,7 @@ ol.format.KML.createFeatureStyleFunction_ = function(style, styleUrl, ol.format.KML.findStyle_ = function(styleValue, defaultStyle, sharedStyles) { if (goog.isArray(styleValue)) { return styleValue; - } else if (goog.isString(styleValue)) { + } else if (typeof styleValue === 'string') { // KML files in the wild occasionally forget the leading `#` on styleUrls // defined in the same document. Add a leading `#` if it enables to find // a style. @@ -1274,7 +1274,7 @@ ol.format.KML.PlacemarkStyleMapParser_ = function(node, objectStack) { 'placemarkObject should be an Object'); if (goog.isArray(styleMapValue)) { placemarkObject['Style'] = styleMapValue; - } else if (goog.isString(styleMapValue)) { + } else if (typeof styleMapValue === 'string') { placemarkObject['styleUrl'] = styleMapValue; } else { goog.asserts.fail('styleMapValue has an unknown type'); @@ -1973,7 +1973,7 @@ ol.format.KML.prototype.readName = function(source) { return this.readNameFromDocument(/** @type {Document} */ (source)); } else if (ol.xml.isNode(source)) { return this.readNameFromNode(/** @type {Node} */ (source)); - } else if (goog.isString(source)) { + } else if (typeof source === 'string') { var doc = ol.xml.parse(source); return this.readNameFromDocument(doc); } else { @@ -2045,7 +2045,7 @@ ol.format.KML.prototype.readNetworkLinks = function(source) { } else if (ol.xml.isNode(source)) { ol.array.extend(networkLinks, this.readNetworkLinksFromNode( /** @type {Node} */ (source))); - } else if (goog.isString(source)) { + } else if (typeof source === 'string') { var doc = ol.xml.parse(source); ol.array.extend(networkLinks, this.readNetworkLinksFromDocument(doc)); } else { diff --git a/src/ol/format/textfeatureformat.js b/src/ol/format/textfeatureformat.js index fc1bddc273..7c86d92a50 100644 --- a/src/ol/format/textfeatureformat.js +++ b/src/ol/format/textfeatureformat.js @@ -26,7 +26,7 @@ goog.inherits(ol.format.TextFeature, ol.format.Feature); * @return {string} Text. */ ol.format.TextFeature.prototype.getText_ = function(source) { - if (goog.isString(source)) { + if (typeof source === 'string') { return source; } else { goog.asserts.fail(); diff --git a/src/ol/format/wfsformat.js b/src/ol/format/wfsformat.js index 325e5a9bf6..0985637b74 100644 --- a/src/ol/format/wfsformat.js +++ b/src/ol/format/wfsformat.js @@ -151,7 +151,7 @@ ol.format.WFS.prototype.readTransactionResponse = function(source) { /** @type {Document} */ (source)); } else if (ol.xml.isNode(source)) { return this.readTransactionResponseFromNode(/** @type {Node} */ (source)); - } else if (goog.isString(source)) { + } else if (typeof source === 'string') { var doc = ol.xml.parse(source); return this.readTransactionResponseFromDocument(doc); } else { @@ -176,7 +176,7 @@ ol.format.WFS.prototype.readFeatureCollectionMetadata = function(source) { } else if (ol.xml.isNode(source)) { return this.readFeatureCollectionMetadataFromNode( /** @type {Node} */ (source)); - } else if (goog.isString(source)) { + } else if (typeof source === 'string') { var doc = ol.xml.parse(source); return this.readFeatureCollectionMetadataFromDocument(doc); } else { diff --git a/src/ol/format/xmlfeatureformat.js b/src/ol/format/xmlfeatureformat.js index 49e3288258..cbee017f33 100644 --- a/src/ol/format/xmlfeatureformat.js +++ b/src/ol/format/xmlfeatureformat.js @@ -42,7 +42,7 @@ ol.format.XMLFeature.prototype.readFeature = function(source, opt_options) { /** @type {Document} */ (source), opt_options); } else if (ol.xml.isNode(source)) { return this.readFeatureFromNode(/** @type {Node} */ (source), opt_options); - } else if (goog.isString(source)) { + } else if (typeof source === 'string') { var doc = ol.xml.parse(source); return this.readFeatureFromDocument(doc, opt_options); } else { @@ -85,7 +85,7 @@ ol.format.XMLFeature.prototype.readFeatures = function(source, opt_options) { /** @type {Document} */ (source), opt_options); } else if (ol.xml.isNode(source)) { return this.readFeaturesFromNode(/** @type {Node} */ (source), opt_options); - } else if (goog.isString(source)) { + } else if (typeof source === 'string') { var doc = ol.xml.parse(source); return this.readFeaturesFromDocument(doc, opt_options); } else { @@ -133,7 +133,7 @@ ol.format.XMLFeature.prototype.readGeometry = function(source, opt_options) { /** @type {Document} */ (source), opt_options); } else if (ol.xml.isNode(source)) { return this.readGeometryFromNode(/** @type {Node} */ (source), opt_options); - } else if (goog.isString(source)) { + } else if (typeof source === 'string') { var doc = ol.xml.parse(source); return this.readGeometryFromDocument(doc, opt_options); } else { @@ -169,7 +169,7 @@ ol.format.XMLFeature.prototype.readProjection = function(source) { return this.readProjectionFromDocument(/** @type {Document} */ (source)); } else if (ol.xml.isNode(source)) { return this.readProjectionFromNode(/** @type {Node} */ (source)); - } else if (goog.isString(source)) { + } else if (typeof source === 'string') { var doc = ol.xml.parse(source); return this.readProjectionFromDocument(doc); } else { diff --git a/src/ol/format/xmlformat.js b/src/ol/format/xmlformat.js index 48b18d9319..c5e0e2d330 100644 --- a/src/ol/format/xmlformat.js +++ b/src/ol/format/xmlformat.js @@ -23,7 +23,7 @@ ol.format.XML.prototype.read = function(source) { return this.readFromDocument(/** @type {Document} */ (source)); } else if (ol.xml.isNode(source)) { return this.readFromNode(/** @type {Node} */ (source)); - } else if (goog.isString(source)) { + } else if (typeof source === 'string') { var doc = ol.xml.parse(source); return this.readFromDocument(doc); } else { diff --git a/src/ol/layer/heatmaplayer.js b/src/ol/layer/heatmaplayer.js index 40d17252e3..26b8ebd764 100644 --- a/src/ol/layer/heatmaplayer.js +++ b/src/ol/layer/heatmaplayer.js @@ -94,7 +94,7 @@ ol.layer.Heatmap = function(opt_options) { var weight = options.weight ? options.weight : 'weight'; var weightFunction; - if (goog.isString(weight)) { + if (typeof weight === 'string') { weightFunction = function(feature) { return feature.get(weight); }; diff --git a/src/ol/map.js b/src/ol/map.js index fe05b5bf50..f9c1829064 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -1495,7 +1495,7 @@ ol.Map.createOptionsInternal = function(options) { if (options.keyboardEventTarget !== undefined) { // cannot use goog.dom.getElement because its argument cannot be // of type Document - keyboardEventTarget = goog.isString(options.keyboardEventTarget) ? + keyboardEventTarget = typeof options.keyboardEventTarget === 'string' ? document.getElementById(options.keyboardEventTarget) : options.keyboardEventTarget; } @@ -1511,7 +1511,7 @@ ol.Map.createOptionsInternal = function(options) { logos[ol.OL3_LOGO_URL] = ol.OL3_URL; } else { var logo = options.logo; - if (goog.isString(logo)) { + if (typeof logo === 'string') { logos[logo] = ''; } else if (goog.isObject(logo)) { goog.asserts.assertString(logo.href, 'logo.href should be a string'); @@ -1541,7 +1541,7 @@ ol.Map.createOptionsInternal = function(options) { if (options.renderer !== undefined) { if (goog.isArray(options.renderer)) { rendererTypes = options.renderer; - } else if (goog.isString(options.renderer)) { + } else if (typeof options.renderer === 'string') { rendererTypes = [options.renderer]; } else { goog.asserts.fail('Incorrect format for renderer option'); diff --git a/src/ol/proj/proj.js b/src/ol/proj/proj.js index 1c49ded408..5b3bd0b6e8 100644 --- a/src/ol/proj/proj.js +++ b/src/ol/proj/proj.js @@ -520,7 +520,7 @@ ol.proj.clearAllProjections = function() { ol.proj.createProjection = function(projection, defaultCode) { if (!projection) { return ol.proj.get(defaultCode); - } else if (goog.isString(projection)) { + } else if (typeof projection === 'string') { return ol.proj.get(projection); } else { goog.asserts.assertInstanceof(projection, ol.proj.Projection, @@ -680,7 +680,7 @@ ol.proj.get = function(projectionLike) { var projection; if (projectionLike instanceof ol.proj.Projection) { projection = projectionLike; - } else if (goog.isString(projectionLike)) { + } else if (typeof projectionLike === 'string') { var code = projectionLike; projection = ol.proj.projections_[code]; if (ol.ENABLE_PROJ4JS) { diff --git a/src/ol/render/canvas/canvasreplay.js b/src/ol/render/canvas/canvasreplay.js index 6b014add32..ebad793ceb 100644 --- a/src/ol/render/canvas/canvasreplay.js +++ b/src/ol/render/canvas/canvasreplay.js @@ -376,7 +376,7 @@ ol.render.canvas.Replay.prototype.replay_ = function( goog.asserts.assert(goog.isNumber(instruction[2]), '3rd instruction should be a number'); dd = /** @type {number} */ (instruction[2]); - goog.asserts.assert(goog.isString(instruction[3]), + goog.asserts.assert(typeof instruction[3] === 'string', '4th instruction should be a string'); text = /** @type {string} */ (instruction[3]); goog.asserts.assert(goog.isNumber(instruction[4]), @@ -497,19 +497,19 @@ ol.render.canvas.Replay.prototype.replay_ = function( ++i; break; case ol.render.canvas.Instruction.SET_FILL_STYLE: - goog.asserts.assert(goog.isString(instruction[1]), + goog.asserts.assert(typeof instruction[1] === 'string', '2nd instruction should be a string'); context.fillStyle = /** @type {string} */ (instruction[1]); ++i; break; case ol.render.canvas.Instruction.SET_STROKE_STYLE: - goog.asserts.assert(goog.isString(instruction[1]), + goog.asserts.assert(typeof instruction[1] === 'string', '2nd instruction should be a string'); goog.asserts.assert(goog.isNumber(instruction[2]), '3rd instruction should be a number'); - goog.asserts.assert(goog.isString(instruction[3]), + goog.asserts.assert(typeof instruction[3] === 'string', '4rd instruction should be a string'); - goog.asserts.assert(goog.isString(instruction[4]), + goog.asserts.assert(typeof instruction[4] === 'string', '5th instruction should be a string'); goog.asserts.assert(goog.isNumber(instruction[5]), '6th instruction should be a number'); @@ -531,11 +531,11 @@ ol.render.canvas.Replay.prototype.replay_ = function( ++i; break; case ol.render.canvas.Instruction.SET_TEXT_STYLE: - goog.asserts.assert(goog.isString(instruction[1]), + goog.asserts.assert(typeof instruction[1] === 'string', '2nd instruction should be a string'); - goog.asserts.assert(goog.isString(instruction[2]), + goog.asserts.assert(typeof instruction[2] === 'string', '3rd instruction should be a string'); - goog.asserts.assert(goog.isString(instruction[3]), + goog.asserts.assert(typeof instruction[3] === 'string', '4th instruction should be a string'); context.font = /** @type {string} */ (instruction[1]); context.textAlign = /** @type {string} */ (instruction[2]); diff --git a/src/ol/renderer/layerrenderer.js b/src/ol/renderer/layerrenderer.js index 6bb4ba492a..bab2159aa7 100644 --- a/src/ol/renderer/layerrenderer.js +++ b/src/ol/renderer/layerrenderer.js @@ -222,7 +222,7 @@ ol.renderer.Layer.prototype.updateAttributions = function(attributionsSet, attri ol.renderer.Layer.prototype.updateLogos = function(frameState, source) { var logo = source.getLogo(); if (logo !== undefined) { - if (goog.isString(logo)) { + if (typeof logo === 'string') { frameState.logos[logo] = ''; } else if (goog.isObject(logo)) { goog.asserts.assertString(logo.href, 'logo.href is a string'); diff --git a/src/ol/source/tileutfgridsource.js b/src/ol/source/tileutfgridsource.js index 7a2e335fbd..22d7b2b9dd 100644 --- a/src/ol/source/tileutfgridsource.js +++ b/src/ol/source/tileutfgridsource.js @@ -277,7 +277,7 @@ ol.source.TileUTFGridTile_.prototype.getData = function(coordinate) { var row = this.grid_[Math.floor((1 - yRelative) * this.grid_.length)]; - if (!goog.isString(row)) { + if (typeof row !== 'string') { return null; } diff --git a/src/ol/style/style.js b/src/ol/style/style.js index a494d2d62a..7ee8039d08 100644 --- a/src/ol/style/style.js +++ b/src/ol/style/style.js @@ -159,7 +159,7 @@ ol.style.Style.prototype.getZIndex = function() { ol.style.Style.prototype.setGeometry = function(geometry) { if (goog.isFunction(geometry)) { this.geometryFunction_ = geometry; - } else if (goog.isString(geometry)) { + } else if (typeof geometry === 'string') { this.geometryFunction_ = function(feature) { var result = feature.get(geometry); if (result) {