Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
making cloning element storage in mootools possible
(function() {
var eliminateOrig = Element.prototype.eliminate;
var localStorage = {};
var get = function(uid){
return (localStorage[uid] || (localStorage[uid] = [])); // converted to an array to store keys stored
lstore: function(property, value) {
// use this instead of
var storage = get(this.uid);
// store the key so we can clone it after
if (!storage[property])
return, arguments);
eliminate: function(property) {
var storage = get(this.uid);
return eliminateOrig.apply(this, arguments);
cloneStorage: function(from) {
// new prototype to clone
var other = get(from.uid);
other.each(function(el) {
this.lstore(el, from.retrieve(el));
}, this);
return this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment