Skip to content

Commit

Permalink
Correctly handle trailing slashes in XML attribute namespaces.
Browse files Browse the repository at this point in the history
See #984
  • Loading branch information
lehni committed Mar 14, 2016
1 parent 7dd110f commit af1c481
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/svg/SvgElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
Expand Down

0 comments on commit af1c481

Please sign in to comment.