]> source.dussan.org Git - svg.js.git/commitdiff
Loop through all children executing modifiers
authornobuti <buti@nobuti.com>
Sat, 27 Oct 2018 02:58:20 +0000 (04:58 +0200)
committernobuti <buti@nobuti.com>
Sat, 27 Oct 2018 02:58:20 +0000 (04:58 +0200)
src/element.js

index 57a83ac2edb294074f433b502358d35f2a53c3c5..f506cb50dd69d0e7f45c5beea88e3fec959b77de 100644 (file)
@@ -273,16 +273,19 @@ SVG.Element = SVG.invent({
         }
       // otherwise act as a getter
       } else {
+        // expose node modifiers
         if (typeof svg === 'function') {
-          well = svg(this)
+          this.each(function () {
+            well = svg(this)
 
-          if (well instanceof SVG.Element) {
-            return well.svg()
-          }
+            if (well instanceof SVG.Element) {
+              this.replace(well)
+            }
 
-          if (typeof well === 'boolean' && !well) {
-            return null
-          }
+            if (typeof well === 'boolean' && !well) {
+              this.remove()
+            }
+          })
         }
 
         // write svgjs data to the dom