mootools/mootools-core — Issue #2193: Element clone storage again
Author: satazor
Created: 2012-01-06 11:23:43+00:00
State: open

Sorry for opening a ticket related to cloning an element storage again, but the other one was closed.

Basically, we do want to clone the element storage in some situations.
Unfortanly, we where unable to do this directly so we made a workaround that worked in 1.4.1 (ugly):

```javascript
(function() {

//TODO: Solve this / send a ticket to mootools

var get = function(uid){
return (storage[uid] || (storage[uid] = {}));
};

var storage = {};

Element.implement({

retrieve: function(property, dflt){
var storage = get($uid(this)), prop = storage[property];
if (dflt != null && prop == null) prop = storage[property] = dflt;
return prop != null ? prop : null;
},

store: function(property, value){
var storage = get($uid(this));
storage[property] = value;
return this;
},

eliminate: function(property){
var storage = get($uid(this));
delete storage[property];
return this;
},

cloneStorage: function(from) {
var fromStorage = get($uid(from));
storage[$uid(this)] = Object.clone(fromStorage);
}
});

})();

```

This does not work anymore because the $uid is not exposed as of 1.4.2.

Someone suggested to manually do this by looking at Element.Storage, but doing console.log(Element.Storage) returns undefined..

Any suggestions?