summaryrefslogtreecommitdiffstats
path: root/src/gradient.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-02-05 00:06:36 +0100
committerwout <wout@impinc.co.uk>2014-02-05 00:06:36 +0100
commit9995944cb253ba93441e2d65cef415daa3541a52 (patch)
tree9d69d943841bec9a25039ee417d58a3125249723 /src/gradient.js
parent43fd91ccce8f9bce60ed7c566e32152be42f9774 (diff)
downloadsvg.js-9995944cb253ba93441e2d65cef415daa3541a52.tar.gz
svg.js-9995944cb253ba93441e2d65cef415daa3541a52.zip
Added loader on SVG.Image and included svg.pattern.js to the core
Diffstat (limited to 'src/gradient.js')
-rwxr-xr-xsrc/gradient.js12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/gradient.js b/src/gradient.js
index e95e18b..504ec49 100755
--- a/src/gradient.js
+++ b/src/gradient.js
@@ -32,7 +32,7 @@ SVG.Gradient = SVG.invent({
}
// Add a color stop
, at: function(stop) {
- return this.put(new SVG.Stop().update(stop))
+ return this.put(new SVG.Stop).update(stop)
}
// Update gradient
, update: function(block) {
@@ -40,7 +40,8 @@ SVG.Gradient = SVG.invent({
this.clear()
/* invoke passed block */
- block(this)
+ if (typeof block == 'function')
+ block.call(this, this)
return this
}
@@ -66,12 +67,7 @@ SVG.Gradient = SVG.invent({
SVG.extend(SVG.Defs, {
// define gradient
gradient: function(type, block) {
- var element = this.put(new SVG.Gradient(type))
-
- /* invoke passed block */
- block(element)
-
- return element
+ return this.put(new SVG.Gradient(type)).update(block)
}
})