From aaaf8f1f3ee676e5733f50114aff5717481f3bcf Mon Sep 17 00:00:00 2001 From: wout Date: Thu, 23 Jan 2014 21:18:43 +0100 Subject: Added the hyperlink element --- dist/svg.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'dist/svg.js') diff --git a/dist/svg.js b/dist/svg.js index a60f378..a7ad178 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -1,4 +1,4 @@ -/* svg.js v0.34 - svg regex default color array number viewbox bbox rbox element parent container fx event defs group arrange mask clip gradient doc shape use rect ellipse line poly path image text textpath nested sugar set memory loader - svgjs.com/license */ +/* svg.js v0.35 - svg regex default color array number viewbox bbox rbox element parent container fx event defs group arrange mask clip gradient doc shape use rect ellipse line poly path image text textpath nested hyperlink sugar set memory loader - svgjs.com/license */ ;(function() { this.SVG = function(element) { @@ -2825,6 +2825,39 @@ }) + 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) + } + + }) + SVG._stroke = ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset'] SVG._fill = ['color', 'opacity', 'rule'] -- cgit v1.2.3