It may fail because this code may overwrite element's properties (and in some browsers like IE and Opera some attributes, mapped as element properties). E.g. $("someInput").store("name", "foo").store("type", "bar"); Better will be some separate container to store values inside, but this leads to back-porting element storage back to Prototype 1.6:
// storage container nested in each element if(typeof Element.store == 'undefined'){ Element.addMethods({ store: function(e, k, v){ e._prototypeStorage = e._prototypeStorage || {}; e._prototypeStorage[k] = v; }, retrieve: function(e, k){ e._prototypeStorage = e._prototypeStorage || {}; return (e._prototypeStorage[k]); } }); } // storage container in closure (function(){ if(typeof Element.store == 'undefined'){ var storage = {}; function uid(e) { // TODO return some uid for element like in Prototype 1.7 } Element.addMethods({ store: function(e, k, v){ var id = uid(e); storage[id] = storage[id] || {}; storage[id][k] = v; }, retrieve: function(e, k){ var id = uid(e); storage[id] = storage[id] || {}; return (storage[id][k]); } }); } })(); -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/TH_WyncdHx0J. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.