From 690fdec4ef4f1213b1561e09944e97252e8cc937 Mon Sep 17 00:00:00 2001 From: Andreas Prang Date: Sat, 16 Feb 2019 02:30:51 +0100 Subject: [PATCH] Fixed missing conversion on Issue #26 for '?' --- lib/js2xml.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/js2xml.js b/lib/js2xml.js index d08da55..8bec427 100644 --- a/lib/js2xml.js +++ b/lib/js2xml.js @@ -64,6 +64,7 @@ function writeAttributes(attributes, options, depth) { quote = options.noQuotesForNativeAttributes && typeof attributes[key] !== 'string' ? '' : '"'; attr = '' + attributes[key]; // ensure number and boolean are converted to String attr = attr.replace(/"/g, '"'); + attr = attr.replace(/[&]/g, '&') attrName = 'attributeNameFn' in options ? options.attributeNameFn(key, attr, currentElementName, currentElement) : key; result.push((options.spaces && options.indentAttributes? writeIndentation(options, depth+1, false) : ' ')); result.push(attrName + '=' + quote + ('attributeValueFn' in options ? options.attributeValueFn(attr, key, currentElementName, currentElement) : attr) + quote);