aboutsummaryrefslogtreecommitdiffstats
path: root/src/element.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2012-12-16 19:40:03 +0100
committerwout <wout@impinc.co.uk>2012-12-16 19:40:03 +0100
commit80ed33ea8e22a45684d72e1ae939c1ff98d0bbf7 (patch)
tree2d122949e5f0dfbf12f7af8629a5f2da733d216c /src/element.js
parent0237a8cae8d545a8b8182dad29863b4426a4f6d2 (diff)
downloadsvg.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.js11
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();