summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-01-23 21:18:43 +0100
committerwout <wout@impinc.co.uk>2014-01-23 21:18:43 +0100
commitaaaf8f1f3ee676e5733f50114aff5717481f3bcf (patch)
tree3371202c48a76d02e01267114c14f7f65ad47e96 /src
parent820b56214181b561212e2b7ef2a3c636bcb836c8 (diff)
downloadsvg.js-aaaf8f1f3ee676e5733f50114aff5717481f3bcf.tar.gz
svg.js-aaaf8f1f3ee676e5733f50114aff5717481f3bcf.zip
Added the hyperlink element
Diffstat (limited to 'src')
-rw-r--r--src/hyperlink.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/hyperlink.js b/src/hyperlink.js
new file mode 100644
index 0000000..9feea30
--- /dev/null
+++ b/src/hyperlink.js
@@ -0,0 +1,32 @@
+SVG.A = function() {
+ this.constructor.call(this, SVG.create('a'))
+}
+
+// Inherit from SVG.Parent
+SVG.A.prototype = new SVG.Container
+
+//
+SVG.extend(SVG.A, {
+ // Link url
+ to: function(url) {
+ return this.attr('href', url, SVG.xlink)
+ }
+ // Link show attribute
+, show: function(target) {
+ return this.attr('show', target, SVG.xlink)
+ }
+ // Link target attribute
+, target: function(target) {
+ return this.attr('target', target)
+ }
+
+})
+
+//
+SVG.extend(SVG.Container, {
+ // Create a hyperlink element
+ link: function(url) {
+ return this.put(new SVG.A).to(url)
+ }
+
+}) \ No newline at end of file