diff --git a/src/ol/layer/vectorlayer.js b/src/ol/layer/vectorlayer.js index a50719c9ab..d777199f5e 100644 --- a/src/ol/layer/vectorlayer.js +++ b/src/ol/layer/vectorlayer.js @@ -326,12 +326,12 @@ ol.layer.Vector.prototype.parseFeatures = function(data, parser, projection) { var callback = function(feature, type) { return lookup[type]; }; - if (typeof data === 'string') { - goog.asserts.assert(typeof parser.readFeaturesFromString === 'function', + if (goog.isString(data)) { + goog.asserts.assert(goog.isFunction(parser.readFeaturesFromString), 'Expected a parser with readFeaturesFromString method.'); features = parser.readFeaturesFromString(data, {callback: callback}); - } else if (typeof data === 'object') { - goog.asserts.assert(typeof parser.readFeaturesFromObject === 'function', + } else if (goog.isObject(data)) { + goog.asserts.assert(goog.isFunction(parser.readFeaturesFromObject), 'Expected a parser with a readFeaturesFromObject method.'); features = parser.readFeaturesFromObject(data, {callback: callback}); } else { diff --git a/src/ol/parser/ogc/exceptionreport.js b/src/ol/parser/ogc/exceptionreport.js index ce2e4990c1..606e96f26a 100644 --- a/src/ol/parser/ogc/exceptionreport.js +++ b/src/ol/parser/ogc/exceptionreport.js @@ -84,7 +84,7 @@ goog.inherits(ol.parser.ogc.ExceptionReport, ol.parser.XML); * @return {Object} Information about the exceptions that occurred. */ ol.parser.ogc.ExceptionReport.prototype.read = function(data) { - if (typeof data == 'string') { + if (goog.isString(data)) { data = goog.dom.xml.loadXml(data); } var exceptionInfo = {}; diff --git a/src/ol/parser/ogc/versioned.js b/src/ol/parser/ogc/versioned.js index 99970abe9d..2685b66e93 100644 --- a/src/ol/parser/ogc/versioned.js +++ b/src/ol/parser/ogc/versioned.js @@ -14,12 +14,12 @@ ol.parser.ogc.Versioned = function(opt_options) { this.defaultVersion = options.defaultVersion || null; this.version = options.version; this.profile = options.profile; - if (options.allowFallback !== undefined) { + if (goog.isDef(options.allowFallback)) { this.allowFallback = options.allowFallback; } else { this.allowFallback = false; } - if (options.stringifyOutput !== undefined) { + if (goog.isDef(options.stringifyOutput)) { this.stringifyOutput = options.stringifyOutput; } else { this.stringifyOutput = false; @@ -103,7 +103,7 @@ ol.parser.ogc.Versioned.prototype.write = function(obj, opt_options) { * @return {Object} An object representing the document. */ ol.parser.ogc.Versioned.prototype.read = function(data, opt_options) { - if (typeof data == 'string') { + if (goog.isString(data)) { data = goog.dom.xml.loadXml(data); } var root = data.documentElement; diff --git a/src/ol/parser/ogc/wmscapabilities_v1.js b/src/ol/parser/ogc/wmscapabilities_v1.js index 860392da99..018fdf2ab5 100644 --- a/src/ol/parser/ogc/wmscapabilities_v1.js +++ b/src/ol/parser/ogc/wmscapabilities_v1.js @@ -230,10 +230,10 @@ ol.parser.ogc.WMSCapabilities_v1 = function() { layer['prefix'] = parts[0]; } capability['layers'].push(layer); - if (layer['formats'] === undefined) { + if (!goog.isDef(layer['formats'])) { layer['formats'] = request['getmap']['formats']; } - if (layer['infoFormats'] === undefined && gfi) { + if (!goog.isDef(layer['infoFormats']) && gfi) { layer['infoFormats'] = gfi['formats']; } } @@ -303,7 +303,7 @@ goog.inherits(ol.parser.ogc.WMSCapabilities_v1, ol.parser.XML); * @return {Object} An object representing the document. */ ol.parser.ogc.WMSCapabilities_v1.prototype.read = function(data) { - if (typeof data == 'string') { + if (goog.isString(data)) { data = goog.dom.xml.loadXml(data); } if (data && data.nodeType == 9) { diff --git a/src/ol/parser/ogc/wmtscapabilities_v1_0_0.js b/src/ol/parser/ogc/wmtscapabilities_v1_0_0.js index fa35ec4c5e..1a6b636d1b 100644 --- a/src/ol/parser/ogc/wmtscapabilities_v1_0_0.js +++ b/src/ol/parser/ogc/wmtscapabilities_v1_0_0.js @@ -154,7 +154,7 @@ goog.inherits(ol.parser.ogc.WMTSCapabilities_v1_0_0, ol.parser.XML); * @return {Object} An object representing the document. */ ol.parser.ogc.WMTSCapabilities_v1_0_0.prototype.read = function(data) { - if (typeof data == 'string') { + if (goog.isString(data)) { data = goog.dom.xml.loadXml(data); } if (data && data.nodeType == 9) {