diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | dist/svg.js | 4 | ||||
-rw-r--r-- | spec/spec/sugar.js | 5 | ||||
-rw-r--r-- | src/modules/optional/sugar.js | 2 | ||||
-rw-r--r-- | todo.md | 4 |
5 files changed, 7 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d74509..250b7f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,7 @@ The document follows the conventions described in [“Keep a CHANGELOG”](http: - `SVG.Text.textPath()` returns only the first textpath child - `attr()` excepts array now to get multiple values at once - `SVG.Text.rebuild()` now takes every font-size into account (#512) +- `fill()` and `stroke()` return the fill and stroke attribute when called as getter (#789) ### Fixed - fixed a bug in clipping and masking where empty nodes persists after removal -> __TODO!__ diff --git a/dist/svg.js b/dist/svg.js index ff69c36..bdf49a1 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -6,7 +6,7 @@ * @copyright Wout Fierens <wout@mick-wout.com> * @license MIT * -* BUILT: Thu Nov 08 2018 13:57:26 GMT+0100 (GMT+01:00) +* BUILT: Thu Nov 08 2018 14:12:10 GMT+0100 (GMT+01:00) */; var SVG = (function () { 'use strict'; @@ -5073,7 +5073,7 @@ var SVG = (function () { extension[m] = function (o) { if (typeof o === 'undefined') { - return this; + return this.attr(m); } if (typeof o === 'string' || Color.isRgb(o) || o instanceof Element) { diff --git a/spec/spec/sugar.js b/spec/spec/sugar.js index 5ec6049..f79d7d5 100644 --- a/spec/spec/sugar.js +++ b/spec/spec/sugar.js @@ -34,10 +34,9 @@ describe('Sugar', function() { expect(rect.attr('fill-rule')).toBe('odd') }) - it('is a nop with no argument given and returns node reference', function() { + it('returns fill color when called as getter', function() { rect.fill('red') - expect(rect.fill()).toBe(rect) - expect(rect.attr('fill')).toBe('red') + expect(rect.fill()).toBe('red') }) }) diff --git a/src/modules/optional/sugar.js b/src/modules/optional/sugar.js index 69f723e..f4c20fc 100644 --- a/src/modules/optional/sugar.js +++ b/src/modules/optional/sugar.js @@ -23,7 +23,7 @@ var sugar = { extension[m] = function (o) { if (typeof o === 'undefined') { - return this + return this.attr(m) } if (typeof o === 'string' || Color.isRgb(o) || (o instanceof Element)) { this.attr(m, o) @@ -4,6 +4,7 @@ - insertAfter - after - before + - ax, ay, amove - Path.js - targets - Element.js @@ -12,9 +13,6 @@ - Style.js - - - # Where We Left Off Saivan |