Have you thought of making a collection like class and adding the elements
to the collection.  Then you could have various methods in the class, like
this:

http://jsfiddle.net/qWGUA/

However, I don't think this is exactly what you are exactly looking for.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Korbinian Moser
Sent: Wednesday, March 02, 2011 3:26 PM
To: MooTools Users
Subject: [Moo] Instance.Properties and how to extend setStyle()??

Hello,

I want to make custom form elements behave like native ones. For example,
$('myCustomElement').get('value') should fetch the value from one of its
child elements. Or $('myCustomElement').setStyle('width',
200) should resize several child elements with a certain logic.

So, I will have to extend set(), get() and setStyle() of my CustomElement
class' wrapper Element.

I found out, that Element.Properties enables extending get() and set() with
custom properties. But if I use that, my changes will influence all
Elements, is that right? So If I overwrite Element.Properties.value, this
will crash the function for all native form elements, right? Is there a way,
to add get/set-Properties to my CustomElement class' wrapper Element only?

And how can setStyle() be extended without losing its default behaviour?

Thanks for any help and best regards from Germany Korbinian

Reply via email to