mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -05:00
Correctly handle trailing slashes in XML attribute namespaces.
See #984
This commit is contained in:
parent
7dd110f5b2
commit
af1c481523
1 changed files with 4 additions and 4 deletions
|
@ -24,9 +24,10 @@ var SvgElement = new function() {
|
||||||
attributeNamespace = {
|
attributeNamespace = {
|
||||||
href: xlink,
|
href: xlink,
|
||||||
xlink: xmlns,
|
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
|
// IE needs the xmlns namespace when setting 'xmlns:xlink'. See #984
|
||||||
'xmlns:xlink': xmlns
|
'xmlns:xlink': xmlns + '/'
|
||||||
};
|
};
|
||||||
|
|
||||||
function create(tag, attributes, formatter) {
|
function create(tag, attributes, formatter) {
|
||||||
|
@ -48,8 +49,7 @@ var SvgElement = new function() {
|
||||||
if (typeof value === 'number' && formatter)
|
if (typeof value === 'number' && formatter)
|
||||||
value = formatter.number(value);
|
value = formatter.number(value);
|
||||||
if (namespace) {
|
if (namespace) {
|
||||||
// IE needs trailing slashes, but only when setting. See #984
|
node.setAttributeNS(namespace, name, value);
|
||||||
node.setAttributeNS(namespace + '/', name, value);
|
|
||||||
} else {
|
} else {
|
||||||
node.setAttribute(name, value);
|
node.setAttribute(name, value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue