diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/clip.js | 15 | ||||
-rw-r--r-- | src/container.js | 4 | ||||
-rw-r--r-- | src/element.js | 2 |
3 files changed, 7 insertions, 14 deletions
diff --git a/src/clip.js b/src/clip.js index 9562162..c1e82cb 100644 --- a/src/clip.js +++ b/src/clip.js @@ -1,5 +1,4 @@ - -SVG.Clip = function Clip() { +SVG.Clip = function() { this.constructor.call(this, SVG.create('clipPath')) } @@ -7,7 +6,6 @@ SVG.Clip = function Clip() { SVG.Clip.prototype = new SVG.Container SVG.extend(SVG.Element, { - // Distribute clipPath to svg element clipWith: function(element) { /* use given clip or create a new one */ @@ -16,13 +14,4 @@ SVG.extend(SVG.Element, { return this.attr('clip-path', 'url(#' + this.clip.attr('id') + ')') } -}) - -// Add container method -SVG.extend(SVG.Container, { - // Create clipping element - clip: function() { - return this.defs().put(new SVG.Clip) - } - -}) +})
\ No newline at end of file diff --git a/src/container.js b/src/container.js index 08a52c8..ac5d685 100644 --- a/src/container.js +++ b/src/container.js @@ -126,6 +126,10 @@ SVG.extend(SVG.Container, { , mask: function() { return this.defs().put(new SVG.Mask) } + // Create clipping element +, clip: function() { + return this.defs().put(new SVG.Clip) + } // Get first child, skipping the defs node , first: function() { return this.children()[0] instanceof SVG.Defs ? this.children()[1] : this.children()[0] diff --git a/src/element.js b/src/element.js index b8cbf50..61f77ff 100644 --- a/src/element.js +++ b/src/element.js @@ -255,7 +255,7 @@ SVG.extend(SVG.Element, { , style: function(s, v) { if (arguments.length == 0) { /* get full style */ - return this.attr('style') + return this.attr('style') || '' } else if (arguments.length < 2) { /* apply every style individually if an object is passed */ |