On Aug 17, 2007, at 12:22 AM, Mislav Marohnić wrote:
> It's nice to hear about how all of you solved the problem of
> collection attribute assignment, but the variety of solutions shows
> that this is very app-specific (IMO).
I won't argue against not including (invoke-ing writeAttribute wo
On 8/17/07, kangax <[EMAIL PROTECTED]> wrote:
>
>
> Writing to attributes is fine but for custom properties I ended up
> with this little helper (I know the name is idiotic but I had no time
> to think of a good one):
>
> Element.addMethods({
> __extend: function(element, hash) {
> return Obj
Writing to attributes is fine but for custom properties I ended up
with this little helper (I know the name is idiotic but I had no time
to think of a good one):
Element.addMethods({
__extend: function(element, hash) {
return Object.extend($(element), hash)
}
});
then just do:
$('a').__
On Aug 15, 2007, at 9:58 AM, Ken Snyder wrote:
> Tom Gregory wrote:
>> apply: function(iterator, attribute, value) {
>> return this.map(function(item, index) {
>>item[attribute] = value;
>> });
>> },
>>
> I've run into a need for this as well. I'd vote for including it
> under
>
I would definitely second the nomination of a name that actually
means something, like 'setAttribute' or similar. But then I'm a fan
of self documenting function names - even when they're long and
include all the letters in words.
On Aug 15, 2007, at 8:58 AM, Ken Snyder wrote:
>
> Tom Greg
Tom Gregory wrote:
> ...
>
> apply: function(iterator, attribute, value) {
> return this.map(function(item, index) {
>item[attribute] = value;
> });
> },
>
> ...
>
>
I've run into a need for this as well. I'd vote for including it under
a name 'setAll' or 'setEach'.
Or, what
I've always felt that it's bad form to give a method two distinctly
different responsibilities.
'pluck' implies getting a property... setting the property should be
named differently (IMHO).
If there is confusion regarding the Enumerable methods, then it should
be dealt with in documentation rath
I was in a similar situation where a pluck like setter would have been
great.
--~--~-~--~~~---~--~~
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
Nice one, Tom!
As far as naming I'd rather go with same pluck but with optional
second argument for setting value
$$('#myFormId input').pluck('disabled'); // getter
$$('#myFormId input').pluck('disabled', true); // setter
You have no idea how much confusion there's among beginners as far as
fig
Okay... so maybe an array of Elements isn't the best example case.
As I've thought about this a bit more, there's an easy way to
accomplish this with Elements using invoke()
$$(selector).invoke('writeAttribute', 'value', 'foo');
... but what about arrays of Hashes/Objects where there i
I am not a member of core, but
+1
I like this for simplicity, but you could possibly use invoke?
$$('#myFormId input').invoke('setAttribute','disabled',true)
Gareth
On 8/15/07, Tom Gregory <[EMAIL PROTECTED]> wrote:
>
>
> It might be something easy that I'm overlooking, but I don't see what
>
11 matches
Mail list logo