From af1c48152340987ed9be26da8ea5f714fa6435b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 14 Mar 2016 18:31:45 +0100 Subject: [PATCH] Correctly handle trailing slashes in XML attribute namespaces. See #984 --- src/svg/SvgElement.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/svg/SvgElement.js b/src/svg/SvgElement.js index 007c406f..df34143c 100644 --- a/src/svg/SvgElement.js +++ b/src/svg/SvgElement.js @@ -24,9 +24,10 @@ var SvgElement = new function() { attributeNamespace = { href: xlink, xlink: xmlns, - xmlns: xmlns, + // Only the xmlns attribute needs the trailing slash. See #984 + xmlns: xmlns + '/', // IE needs the xmlns namespace when setting 'xmlns:xlink'. See #984 - 'xmlns:xlink': xmlns + 'xmlns:xlink': xmlns + '/' }; function create(tag, attributes, formatter) { @@ -48,8 +49,7 @@ var SvgElement = new function() { if (typeof value === 'number' && formatter) value = formatter.number(value); if (namespace) { - // IE needs trailing slashes, but only when setting. See #984 - node.setAttributeNS(namespace + '/', name, value); + node.setAttributeNS(namespace, name, value); } else { node.setAttribute(name, value); }