summaryrefslogtreecommitdiffstats
path: root/src/elements
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-19 21:49:21 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-19 21:49:21 +0100
commit2b37d7ba5b4267b39c86f9aba5fb14a1b376e846 (patch)
tree279c1feafcc398fa43aef375ae995068c6093ed1 /src/elements
parent9943813f3779d2ede508a90dadd087fc0ad12f1f (diff)
downloadsvg.js-2b37d7ba5b4267b39c86f9aba5fb14a1b376e846.tar.gz
svg.js-2b37d7ba5b4267b39c86f9aba5fb14a1b376e846.zip
rename `doc()` to `root()` and `toDoc()` to `toRoot()` as dicussed in (#932)
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/Element.js6
-rw-r--r--src/elements/Image.js4
-rw-r--r--src/elements/Svg.js8
-rw-r--r--src/elements/TextPath.js2
4 files changed, 10 insertions, 10 deletions
diff --git a/src/elements/Element.js b/src/elements/Element.js
index 1f208c5..91aa3e0 100644
--- a/src/elements/Element.js
+++ b/src/elements/Element.js
@@ -52,13 +52,13 @@ export default class Element extends Dom {
// Get defs
defs () {
- return this.doc().defs()
+ return this.root().defs()
}
// Get parent document
- doc () {
+ root () {
let p = this.parent(Svg)
- return p && p.doc()
+ return p && p.root()
}
getEventHolder () {
diff --git a/src/elements/Image.js b/src/elements/Image.js
index bf2de0e..8f27470 100644
--- a/src/elements/Image.js
+++ b/src/elements/Image.js
@@ -52,12 +52,12 @@ registerAttrHook(function (attr, val, _this) {
// convert image fill and stroke to patterns
if (attr === 'fill' || attr === 'stroke') {
if (isImage.test(val)) {
- val = _this.doc().defs().image(val)
+ val = _this.root().defs().image(val)
}
}
if (val instanceof Image) {
- val = _this.doc().defs().pattern(0, 0, (pattern) => {
+ val = _this.root().defs().pattern(0, 0, (pattern) => {
pattern.add(val)
})
}
diff --git a/src/elements/Svg.js b/src/elements/Svg.js
index e634c6a..6172454 100644
--- a/src/elements/Svg.js
+++ b/src/elements/Svg.js
@@ -24,14 +24,14 @@ export default class Svg extends Container {
// Check if this is a root svg
// If not, call docs from this element
- doc () {
+ root () {
if (this.isRoot()) return this
- return super.doc()
+ return super.root()
}
// Add namespaces
namespace () {
- if (!this.isRoot()) return this.doc().namespace()
+ if (!this.isRoot()) return this.root().namespace()
return this
.attr({ xmlns: ns, version: '1.1' })
.attr('xmlns:xlink', xlink, xmlns)
@@ -40,7 +40,7 @@ export default class Svg extends Container {
// Creates and returns defs element
defs () {
- if (!this.isRoot()) return this.doc().defs()
+ if (!this.isRoot()) return this.root().defs()
return adopt(this.node.getElementsByTagName('defs')[0]) ||
this.put(new Defs())
diff --git a/src/elements/TextPath.js b/src/elements/TextPath.js
index 324d768..91c48ae 100644
--- a/src/elements/TextPath.js
+++ b/src/elements/TextPath.js
@@ -51,7 +51,7 @@ registerMethods({
// if track is a path, reuse it
if (!(track instanceof Path)) {
// create path element
- track = this.doc().defs().path(track)
+ track = this.root().defs().path(track)
}
// link textPath to path and add content