@Walter: I don't think Hash has a length member.
@Eric: That will replace *that reference* to the Hash, but any other
references will still refer to the old object. So, for instance, if
the reference has been passed into a function, that will update that
function's reference to point to a new hash, but the caller will still
refer to the old has and its contents.
@Chrysanthe: I'm pretty sure Hash doesn't have any built-in feature
for this. You could add one:
Class.addMethods(Hash, (function() {
function clear() {
this._object = {};
}
return {
clear: clear
};
})());
(That's off-the-cuff, you'll want to double-check it.) Naturally that
means you need to check that that's still compatible each time you
update your copy of Prototype (even dot revs), since it acts on
internals.
FWIW,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com
On Mar 31, 12:58 pm, Eric lefauv...@gmail.com wrote:
Something like that should do it:
yourHash = $H();
You're affecting a new empty hash to your old hash, which should be
garbage collected by the browser.
Eric
On Mar 29, 8:47 pm, Walter Lee Davis wa...@wdstudio.com wrote:
So if you had a hash of N length and you wanted to end up with a hash
with no members? You could try setting its length to 0. Not sure if
that works, but it would be the first thing I would try.
Walter
On Mar 29, 2010, at 2:26 PM, chrysanthe m wrote:
Hello
I am sure this is documented somewhere, I have googled and looked at
the api
however it is still unclear. How can I zero our all the keys/values
of a
prototype hash without iterating over it? Sorry if it is
documented, I
couldn't find an api faq. tia.
--
You received this message because you are subscribed to the Google
Groups Prototype script.aculo.us group.
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
athttp://groups.google.com/group/prototype-scriptaculous?hl=en
.
--
You received this message because you are subscribed to the Google Groups
Prototype script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@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.