summaryrefslogtreecommitdiffstats
path: root/src/hyperlink.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/hyperlink.js')
-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