aboutsummaryrefslogtreecommitdiffstats
path: root/src/elements
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2023-09-03 09:49:01 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2023-09-03 09:49:01 +0200
commitca8ac554bfafe6b4d7985fe3130ff3dffa6029ca (patch)
tree5dcecd8f32564fb3fb95e8846344b0b26c05dc24 /src/elements
parentd66be92f19e1004fd250ba1d020db2436f9eb65b (diff)
downloadsvg.js-ca8ac554bfafe6b4d7985fe3130ff3dffa6029ca.tar.gz
svg.js-ca8ac554bfafe6b4d7985fe3130ff3dffa6029ca.zip
doscontinue use of svgjs:data in favor of data-svg
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/Element.js8
-rw-r--r--src/elements/Svg.js10
2 files changed, 12 insertions, 6 deletions
diff --git a/src/elements/Element.js b/src/elements/Element.js
index 7a563d6..e3a4211 100644
--- a/src/elements/Element.js
+++ b/src/elements/Element.js
@@ -25,9 +25,13 @@ export default class Element extends Dom {
// create circular reference
this.node.instance = this
- if (node.hasAttribute('svgjs:data')) {
+ if (node.hasAttribute('data-svgjs') || node.hasAttribute('svgjs:data')) {
// pull svgjs data from the dom (getAttributeNS doesn't work in html5)
- this.setData(JSON.parse(node.getAttribute('svgjs:data')) || {})
+ this.setData(
+ JSON.parse(node.getAttribute('data-svgjs')) ??
+ JSON.parse(node.getAttribute('svgjs:data')) ??
+ {}
+ )
}
}
diff --git a/src/elements/Svg.js b/src/elements/Svg.js
index 7b36daa..40d50c9 100644
--- a/src/elements/Svg.js
+++ b/src/elements/Svg.js
@@ -4,7 +4,7 @@ import {
register,
wrapWithAttrCheck
} from '../utils/adopter.js'
-import { svg, svgjs, xlink, xmlns } from '../modules/core/namespaces.js'
+import { svg, xlink, xmlns } from '../modules/core/namespaces.js'
import { registerMethods } from '../utils/methods.js'
import Container from './Container.js'
import Defs from './Defs.js'
@@ -34,9 +34,11 @@ export default class Svg extends Container {
// Add namespaces
namespace() {
if (!this.isRoot()) return this.root().namespace()
- return this.attr({ xmlns: svg, version: '1.1' })
- .attr('xmlns:xlink', xlink, xmlns)
- .attr('xmlns:svgjs', svgjs, xmlns)
+ return this.attr({ xmlns: svg, version: '1.1' }).attr(
+ 'xmlns:xlink',
+ xlink,
+ xmlns
+ )
}
removeNamespace() {