diff options
author | wout <wout@impinc.co.uk> | 2012-12-16 19:40:03 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2012-12-16 19:40:03 +0100 |
commit | 80ed33ea8e22a45684d72e1ae939c1ff98d0bbf7 (patch) | |
tree | 2d122949e5f0dfbf12f7af8629a5f2da733d216c /src/element.js | |
parent | 0237a8cae8d545a8b8182dad29863b4426a4f6d2 (diff) | |
download | svg.js-80ed33ea8e22a45684d72e1ae939c1ff98d0bbf7.tar.gz svg.js-80ed33ea8e22a45684d72e1ae939c1ff98d0bbf7.zip |
Added attr function for SVG.Element
Diffstat (limited to 'src/element.js')
-rw-r--r-- | src/element.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/element.js b/src/element.js index bf729cd..d6f4685 100644 --- a/src/element.js +++ b/src/element.js @@ -68,6 +68,17 @@ SVG.Element.prototype.setAttribute = function(a, v, ns) { return this; }; +// set svg element attribute +SVG.Element.prototype.attr = function(v) { + if (typeof v == 'object') + for (var k in v) + this.setAttribute(k, v[k]); + else if (arguments.length == 2) + this.setAttribute(arguments[0], arguments[1]); + + return this; +}; + // get bounding box SVG.Element.prototype.getBBox = function() { return this.svgElement.getBBox(); |