From d68a88da2615039be52666fddcb3259b7f88b054 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 20 Dec 2013 17:53:46 +0100 Subject: [PATCH 1/3] Always return an array of features, even if no features are read --- src/ol/format/geojsonformat.js | 2 +- src/ol/format/xmlformat.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ol/format/geojsonformat.js b/src/ol/format/geojsonformat.js index 9c4acc76f9..8d975f6a4c 100644 --- a/src/ol/format/geojsonformat.js +++ b/src/ol/format/geojsonformat.js @@ -331,7 +331,7 @@ ol.format.GeoJSON.prototype.readFeaturesFromObject = function(object) { return features; } else { goog.asserts.fail(); - return null; + return []; } }; diff --git a/src/ol/format/xmlformat.js b/src/ol/format/xmlformat.js index e957102d82..0025cbd452 100644 --- a/src/ol/format/xmlformat.js +++ b/src/ol/format/xmlformat.js @@ -79,7 +79,7 @@ ol.format.XML.prototype.readFeatures = function(source) { return this.readFeaturesFromDocument(doc); } else { goog.asserts.fail(); - return null; + return []; } }; From e183a2daf1b8079cabdcefef65c5a87abc53724a Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 20 Dec 2013 18:01:27 +0100 Subject: [PATCH 2/3] Don't rely on getResponseXml --- src/ol/source/vectorfilesource.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ol/source/vectorfilesource.js b/src/ol/source/vectorfilesource.js index 865f647e55..b43fcc68bf 100644 --- a/src/ol/source/vectorfilesource.js +++ b/src/ol/source/vectorfilesource.js @@ -3,6 +3,7 @@ goog.provide('ol.source.VectorFile'); goog.require('goog.asserts'); +goog.require('goog.dom.xml'); goog.require('goog.net.XhrIo'); goog.require('ol.format.FormatType'); goog.require('ol.proj'); @@ -83,6 +84,9 @@ ol.source.VectorFile.prototype.handleXhrIo_ = function(event) { source = xhrIo.getResponseText(); } else if (type == ol.format.FormatType.XML) { source = xhrIo.getResponseXml(); + if (goog.isNull(source)) { + source = goog.dom.xml.loadXml(xhrIo.getResponseText()); + } } else { goog.asserts.fail(); } From 422966668dcccc2bca8d55fdf406be8d748db763 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 20 Dec 2013 18:30:00 +0100 Subject: [PATCH 3/3] Do not put property name on following line Currently, bin/generate-exports.py will ignore properties whose name is not on the same line as the @property directive. --- src/objectliterals.jsdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 8dc27ba5d6..3f5b0319f8 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -277,8 +277,8 @@ /** * @typedef {Object} olx.interaction.DragAndDropOptions * @property {boolean|undefined} fitView Fit view. Default is `true`. - * @property {Array.|undefined} - * formatConstructors Format constructors. + * @property {Array.|undefined} formatConstructors + * Format constructors. * @property {ol.source.Vector|undefined} source Source. If this is defined * then features will be added to this source. * @property {ol.layer.Vector|undefined} layer Layer. If this is defined then