On Jul 14, 2007, at 1:32 PM, Tobie Langel wrote:

> I'm failing to see what advantage it has over directly storing a
> reference to the element like so:
>
> this.myElement = $(e);
> ...
> var e = this.myElement;

I'm using a similar technique in a couple of applications where I  
needed to cache references to parent nodes of certain elements.  In  
order to avoid circular references, the parent nodes' IDs are stored  
in custom attributes and dereferenced with $().

It's not always convenient to give those nodes IDs in HTML, so I  
settled an Element#denominate method that assigns IDs if they don't  
exist using a string prefix + new Date().getTime().  (I do like Jeff's  
suggestion of using an auto-incrementing value instead of a timestamp.)

It's a good fit for core, IMO.

-sam


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to