I'm developing this plugin where to get the functionality I want, I would have to pollute the jQuery prototype a lot. This made me think of an approach where I derive a new class using $.fn as prototype. Then I could use one “entry method” which returns instances of my subclass. However this doesn’t work because jQuery methods rely heavily on the jQuery( elems ) construct which breaks out of my subclassed chain. This could be remedied by making jQuery methods dynamically load jQuery i.e. this.jQuery which then could be overridden. Does that sound doable?
One can argue the approach is flawed because a jQuery chain can easily transform itself to include elements from outside the original set, where the additions/modifications of the subclass won’t make any sense. However that could be solved by dividing the jQuery methods over two classes in a hierarchy. All methods that can’t widen the set go into the base class, and the rest into a subclass. Then you can extend the base class in a more sensible way. Maybe ripping jQuery in two sounds a bit harsh… /Andreas Karlsson, Stockholm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
