From b09f7e30b22dacdc7017f4ece9c3a2387191ba59 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 2 Mar 2016 13:55:30 +0100 Subject: [PATCH] Get rid of goog.dom.xml.serialize Use XMLSerializer.serializeToString() function instead, available for IE >= 9 --- src/ol/format/xmlfeatureformat.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ol/format/xmlfeatureformat.js b/src/ol/format/xmlfeatureformat.js index cbee017f33..dbb742afde 100644 --- a/src/ol/format/xmlfeatureformat.js +++ b/src/ol/format/xmlfeatureformat.js @@ -2,7 +2,6 @@ goog.provide('ol.format.XMLFeature'); goog.require('goog.asserts'); goog.require('goog.dom.NodeType'); -goog.require('goog.dom.xml'); goog.require('ol.array'); goog.require('ol.format.Feature'); goog.require('ol.format.FormatType'); @@ -20,6 +19,13 @@ goog.require('ol.xml'); * @extends {ol.format.Feature} */ ol.format.XMLFeature = function() { + + /** + * @type {XMLSerializer} + * @private + */ + this.xmlSerializer_ = new XMLSerializer(); + goog.base(this); }; goog.inherits(ol.format.XMLFeature, ol.format.Feature); @@ -206,7 +212,7 @@ ol.format.XMLFeature.prototype.writeFeature = function(feature, opt_options) { var node = this.writeFeatureNode(feature, opt_options); goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, 'node.nodeType should be ELEMENT'); - return goog.dom.xml.serialize(/** @type {Element} */(node)); + return this.xmlSerializer_.serializeToString(node); }; @@ -226,7 +232,7 @@ ol.format.XMLFeature.prototype.writeFeatures = function(features, opt_options) { var node = this.writeFeaturesNode(features, opt_options); goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, 'node.nodeType should be ELEMENT'); - return goog.dom.xml.serialize(/** @type {Element} */(node)); + return this.xmlSerializer_.serializeToString(node); }; @@ -245,7 +251,7 @@ ol.format.XMLFeature.prototype.writeGeometry = function(geometry, opt_options) { var node = this.writeGeometryNode(geometry, opt_options); goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, 'node.nodeType should be ELEMENT'); - return goog.dom.xml.serialize(/** @type {Element} */(node)); + return this.xmlSerializer_.serializeToString(node); };