On Aug 19, 12:35 pm, John-David Dalton <[EMAIL PROTECTED]>
wrote:
> More on the get/set
>
> Maybe get/set are more generalized
> Get: would first check the property and then the attribute;
> Set: would use the element['somePropOrAttrib'] = value;
> instead of setAttribute and let the browser figure it out.
>
> If you want finer grain then you can use
> getProperty() and getAttribute,
> setProperty() and setAttribute,
>
> Most though would be fine using get/set
> and letting Prototype figure it out.

John,
I don't think we should let prototype figure it out. Honestly, I don't
see a reason to mix attributes with properties. There's a
`readAttribute`/`writeAttribute` interface (for attributes), so we
only need the one for properties - `get`/`set` or `getProperty`/
`setProperty`.

I also think making setters support accepting function could make for
a much more flexibility. A function would be called with a current
value of a property (that's being acted upon) and its result would be
the one that is assigned to a property:

$W('myElement').set('innerHTML', function(value){ return value + '.
The end...'; });

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