aboutsummaryrefslogtreecommitdiffstats
path: root/src/element.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/element.js')
-rw-r--r--src/element.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/element.js b/src/element.js
index f506cb5..406a35e 100644
--- a/src/element.js
+++ b/src/element.js
@@ -278,14 +278,15 @@ SVG.Element = SVG.invent({
this.each(function () {
well = svg(this)
- if (well instanceof SVG.Element) {
- this.replace(well)
- }
-
- if (typeof well === 'boolean' && !well) {
+ // If modifier returns false, discard node
+ if (well === false) {
this.remove()
+
+ // If modifier returns new node, use it
+ } else if (well && well !== this) {
+ this.replace(well)
}
- })
+ }, true)
}
// write svgjs data to the dom