On Aug 20, 10:13 am, John-David Dalton <[EMAIL PROTECTED]>
wrote:
> Kangax looks good.
> I think that it should be $() instead of $W(), but for the purpose of
> clarity during the
> discussion the use of $W is fine.
>
> I think that any method that returned element, will instead return
> NodeWrapper.
> Any method that returned an array of elements will return a
> NodeListWrapper.
> (In implementation I think $$() should be used but for discussion $
> $W() will be used
> to avoid confusion)
>
> $$W('input:not([disabled])').highlight();
> $$('input:not([disabled])').invoke('highlight');

I'm in favor of such syntax.
Besides a performance increase (comparing to `invoke`) this makes the
code somewhat more concise.

>
> I think we should follow jQuery's lead here and extend the
> Element.Methods and Enumerable methods
> to the NodeListWrapper.
> $$W(...).each, $$(...).without, ... $$(...).hide(), $$(...).observe

I think it does make sense to mixin Enumerable - NodeList is a
collection after all. I just hope there won't be name conflicts
between Enumerable methods and user-defined ones.

>
> If the node list returns 1 element then methods like $$
> (...).getValue() should return the value of that element.
> (this is how jQuery handles it)

This could lead to ambiguity. We should probably discuss it more.

>
> I think $A should return a ListWrapper, maybe ListWrapper could be the
> $super for NodeListWrapper.
> ListWrapper would have methods of Array Additions and Enumerable
> methods.

Definitely a possibility if we stop extending Array.prototype.
Otherwise, I don't see much usefulness in this. NodeListWrapper
encapsulates an array of `NodeWrapper`s and its methods operate
directly on those `NodeWrapper`. A custom `_each` and mixed-in
Enumerable would take care of iteration. Am I missing something?

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