You're right, that would be a unusual way to do it. That's not what I was suggesting to do at all. You should use store and retrieve for data and objects that relate to an element.
For your helper methods, you could either add them to Element using implement, or you could add setters and getters to Element.Properties. On Tue, Dec 7, 2010 at 5:09 AM, Maxim Lacrima <[email protected]>wrote: > Hi! > > I have been trying to build some widgets for my webapp. > Before I had read this blog post > http://mootools.net/blog/2010/06/10/setting-up-elements/ > I was augmenting my elements in the following way: > > var myForm = new Element('form'); > myForm.fields = { > firstName: new Element('input', { > 'type': 'text', > 'name': 'firstName', > 'id': 'firstName' > }), > /* other fields */ > } > myForm.setLabel = function(label, fieldName) { > /* function body */ > }; > > Now according to the blog post I should augment my elements in a different > way: > myForm.store('setLabel', function(label, fieldName) { > /* function body */ > }); > And call the function as: > myForm.retrieve('setLabel')('First name:', 'firstName'); > > Do I correctly understand the blog post? If so, it is quite unusual > for me to call my helper methods in this way. > Thanks in advance. > > -- > with regards, > Maxim >
