aboutsummaryrefslogtreecommitdiffstats
path: root/src/element.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-08-01 20:40:49 +0200
committerwout <wout@impinc.co.uk>2014-08-01 20:40:49 +0200
commitf0dc4d5ee03add261242743aa583c19d918f317c (patch)
tree2d480aed288eb180e53c3c0fba8623029478db8b /src/element.js
parentc2d1b2916b38d111d8672826c1219ab891567798 (diff)
downloadsvg.js-f0dc4d5ee03add261242743aa583c19d918f317c.tar.gz
svg.js-f0dc4d5ee03add261242743aa583c19d918f317c.zip
Added SVG.Bare for creation of non-described elements
Diffstat (limited to 'src/element.js')
-rwxr-xr-xsrc/element.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/element.js b/src/element.js
index b319e00..8db2359 100755
--- a/src/element.js
+++ b/src/element.js
@@ -2,15 +2,15 @@
SVG.Element = SVG.invent({
// Initialize node
create: function(node) {
- // Make stroke value accessible dynamically
+ // make stroke value accessible dynamically
this._stroke = SVG.defaults.attrs.stroke
- // Create circular reference
+ // create circular reference
if (this.node = node) {
this.type = node.nodeName
this.node.instance = this
- // Store current attribute value
+ // store current attribute value
this._stroke = node.getAttribute('stroke') || this._stroke
}
}
@@ -185,7 +185,7 @@ SVG.Element = SVG.invent({
// act as a setter if svg is given
if (svg && this instanceof SVG.Parent) {
// dump raw svg
- well.innerHTML = '<svg>' + svg + '</svg>'
+ well.innerHTML = '<svg>' + svg.replace(/\n/, '').replace(/<(\w+)([^<]+?)\/>/g, '<$1$2></$1>') + '</svg>'
// transplant nodes
for (var i = 0, il = well.firstChild.childNodes.length; i < il; i++)