aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-08-22 13:26:11 +0100
committerwout <wout@impinc.co.uk>2013-08-22 13:26:11 +0100
commitbd58094c43ab78bec28ec97e62e71af9ad2febb4 (patch)
treeb92c6d901089854df58d18493e786a34207bee43 /src
parentd93be6ca2bce202af05ff0966e7c70195b786299 (diff)
downloadsvg.js-bd58094c43ab78bec28ec97e62e71af9ad2febb4.tar.gz
svg.js-bd58094c43ab78bec28ec97e62e71af9ad2febb4.zip
Fixed bug in memory system
Diffstat (limited to 'src')
-rw-r--r--src/memory.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/memory.js b/src/memory.js
index 336716a..9b6f308 100644
--- a/src/memory.js
+++ b/src/memory.js
@@ -1,9 +1,6 @@
SVG.extend(SVG.Element, {
- // Initialize local memory object
- _memory: {}
-
// Remember arbitrary data
-, remember: function(k, v) {
+ remember: function(k, v) {
/* remember every item in an object individually */
if (typeof arguments[0] == 'object')
for (var v in k)
@@ -11,11 +8,11 @@ SVG.extend(SVG.Element, {
/* retrieve memory */
else if (arguments.length == 1)
- return this._memory[k]
+ return this.memory()[k]
/* store memory */
else
- this._memory[k] = v
+ this.memory()[k] = v
return this
}
@@ -26,9 +23,14 @@ SVG.extend(SVG.Element, {
this._memory = {}
else
for (var i = arguments.length - 1; i >= 0; i--)
- delete this._memory[arguments[i]]
+ delete this.memory()[arguments[i]]
return this
}
+ // Initialize or return local memory object
+, memory: function() {
+ return this._memory || (this._memory = {})
+ }
+
}) \ No newline at end of file