diff options
Diffstat (limited to 'src/element.js')
-rw-r--r-- | src/element.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/element.js b/src/element.js index ab2a1e9..e1e69ec 100644 --- a/src/element.js +++ b/src/element.js @@ -204,8 +204,11 @@ SVG.extend(SVG.Element, { // Store data values on svg nodes data: function(a, v) { if (arguments.length < 2) { - var value = this.attr('data-' + a); - try { return JSON.parse(value); } catch(e) { return value; }; + try { + return JSON.parse(this.attr('data-' + a)); + } catch(e) { + return this.attr('data-' + a); + }; } else { v === null ? |