On Aug 20, 10:33 pm, John-David Dalton <[EMAIL PROTECTED]>
wrote:
> @Key Snyder - correct I was assuming Array.prototype was not extended
> and that we were using wrappers.
Well, if `ListWrapper` is Enumerable + `Array.prototype` extensions,
then yes, it does make sense : )
>
> @kangax
>
> I don't think there would be confusion with things like $$
> (..).getValue() here.
>
> Keep in mind users do use the equiv of $$('#myId') and that in those
> cases you are expecting 1 result
> so the desired behavior of a readAttribute, or getValue or anything
> getting a property
> is to return from the only matched item.
True.
We could reduce ambiguity by having some kind of a generic rule - e.g.
"all accessor methods always act on the first item". This should be
fine, as long as there are no (or not many) exceptions.
>
> jQuery takes $('input').val(), (our $$('input').getValue()) and only
> returns the value of the first item regardless of how many elements
> are matched.
> If you want an array of values then $$('input').invoke('getValue')
> would do.
>
> I think millions of downloads and that its popularity among casual/new
> programmers
> speaks to its ease of use.
I wouldn't focus on general appeal here, but rather on increasing
compatibility and performance : )
Nevertheless, I agree that such syntax could be useful.
>
> Anyway I like the direction things are headed,
> can't wait to start hammering on code :).
Cool.
I forked prototype, and started working on NodeWrapper/NodeListWrapper
- http://github.com/kangax/prototype/tree/master/src/element.js
Accompanying tests are there as well (although the test suite is far
from being complete).
--
kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---