On Aug 18, 11:27 am, John-David Dalton <[EMAIL PROTECTED]>
wrote:
> If a cache is to be used it can be uniquely marked via the same
> approach as elements in the event system
> element._prototypeWrapperId = [arguments.callee.id++];
> the id is unique and doesn't transfer if you clone the node.
>
> var instance = Prototype.Element.cache[ element._prototypeWrapperId ];
> if (instance) return instance;
>
> This would work well with this patch (allowing Class.create to return
> a value).http://dev.rubyonrails.org/ticket/11481
>
> Some host objects may not allow the addition of custom properties
> though, and in
> those cases they wouldn't get cached.
>
> I like having a common property for the wrapped object (+1 for the
> suggestion):
> var el = new Prototype.Element(element);
> el.raw, or el.obj, or el.wrapped, or el.source.
> I kinda dig el.source

`source` sounds good. I just looked at YUI3 and it seems like they
only expose `_yuid` as a public property of their wrapper
implementation - everything else is accessed via `get`/`set` (which is
great, imo).

I think having Node and NodeList wrappers should be enough from the
start. NodeList could be returned by `$$` and implement some DOM
methods which would operate on the entire collection:

$('foo').show(); // operates on an element
$$('div.foo').show(); // operates on a NodeList

--
kangax
--~--~---------~--~----~------------~-------~--~----~
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