diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2020-04-26 08:59:21 +1000 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2020-04-26 09:00:25 +1000 |
commit | ed08a24bbbc2774e1a570430c0243db4f51883f3 (patch) | |
tree | 70e47d414a18a5ea2d846f171c51cf80768f5e44 /src/modules | |
parent | b8427b841323fe2c8dc14584b0b10c30159d2023 (diff) | |
download | svg.js-ed08a24bbbc2774e1a570430c0243db4f51883f3.tar.gz svg.js-ed08a24bbbc2774e1a570430c0243db4f51883f3.zip |
add tests for selector and arrange, simplifed front() and back()
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/optional/arrange.js | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/modules/optional/arrange.js b/src/modules/optional/arrange.js index 7c9d994..7db4386 100644 --- a/src/modules/optional/arrange.js +++ b/src/modules/optional/arrange.js @@ -53,21 +53,17 @@ export function front () { var p = this.parent() // Move node forward - p.node.appendChild(this.node) - - // Make sure defs node is always at the top - if (typeof p.isRoot === 'function' && p.isRoot()) { - p.node.appendChild(p.defs().node) - } + p.add(this.remove()) return this } // Send given element all the way to the back export function back () { - if (this.position() > 0) { - this.parent().removeElement(this).add(this, 0) - } + var p = this.parent() + + // Move node back + p.add(this.remove(), 0) return this } |