From: nobuti Date: Sat, 27 Oct 2018 02:58:20 +0000 (+0200) Subject: Loop through all children executing modifiers X-Git-Tag: 3.0.0~57^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=72bc2f64395f74875c17ca57905bee5bd0fe9467;p=svg.js.git Loop through all children executing modifiers --- diff --git a/src/element.js b/src/element.js index 57a83ac..f506cb5 100644 --- a/src/element.js +++ b/src/element.js @@ -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