From e6399a265dea4b3cb8bdb012aa3554dc4172116d Mon Sep 17 00:00:00 2001 From: tschaub Date: Thu, 25 Oct 2012 11:56:48 -0600 Subject: [PATCH 1/2] Use document fragments to write multiple nodes For writer functions that need to generate multiple nodes, the createDocumentFragment method can be used. --- lib/OpenLayers/Format/Filter/v1.js | 38 +++++++----------------------- lib/OpenLayers/Format/XML.js | 20 ++++++++++++++++ tests/Format/XML.html | 29 +++++++++++++++++++++++ 3 files changed, 57 insertions(+), 30 deletions(-) diff --git a/lib/OpenLayers/Format/Filter/v1.js b/lib/OpenLayers/Format/Filter/v1.js index bd7cc32f09..824984828d 100644 --- a/lib/OpenLayers/Format/Filter/v1.js +++ b/lib/OpenLayers/Format/Filter/v1.js @@ -281,19 +281,6 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, { return this.writers.ogc["Filter"].apply(this, [filter]); }, - /** - * Method: writeFeatureIdNodes - * - * Parameters: - * filter - { Date: Thu, 25 Oct 2012 12:11:25 -0600 Subject: [PATCH 2/2] Unnecessary call to appendChild The writeNode function already calls appendChild on the parent. --- lib/OpenLayers/Format/Filter/v1.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Format/Filter/v1.js b/lib/OpenLayers/Format/Filter/v1.js index 824984828d..48deb0f9cb 100644 --- a/lib/OpenLayers/Format/Filter/v1.js +++ b/lib/OpenLayers/Format/Filter/v1.js @@ -259,9 +259,8 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, { * {DOMElement} Updated node element. */ writeOgcExpression: function(value, node) { - if(value instanceof OpenLayers.Filter.Function){ - var child = this.writeNode("Function", value, node); - node.appendChild(child); + if (value instanceof OpenLayers.Filter.Function){ + this.writeNode("Function", value, node); } else { this.writeNode("Literal", value, node); }