Just following up on my own internal discussion from last night about my ActiveForm javascript library.
I started switching everything to extend the elements themselves instead of building the functionality into separate objects. One thing I found was there was no way extending the form element was going to work. There would be too many name space conflicts. One of them being “name”. The form already has a name, so if you were making a form for a user, it would possibly try to make “user.name”. That would be bad. So that was out.
As far as the inputs themselves, that went more smoothly. I’m not trying to add dynamically generated methods to those objects, so there’s little problem with name space. In fact, switching allowed me to drastically clean up my ActiveForm class. Before I had to use eval() to embed certain functionality into an input, but once I was extending the input directly this wasn’t necessary anymore.
I’m really liking how this is turning out, and I’m looking forward to using it on future projects.