> JS is Object Oriented.  So are we really just talking about classical
> inheritance (and even more specific, _super) ?

Yeah, I'm talking about constructing classes and inheritance.

> I see how widget.js creates a plugin.  But how does one expand on the
> plugin?

There's two ways (one implemented, one not yet).
 - Not implemented yet is a way to take an existing plugin and derive
a new plugin from it (one that completely overrides some existing
methods)
 - Right now there's an easy way to inject new functionality into
existing plugins.

For example right now you would be able to do the following (if you
wanted to make an element fade out when a drag stops):

jQuery.plugin("draggable", {
  options: { isBeingDragged: false },
  setup: function(){ /* Setup... */ },
  methods: {
    stopDrag: function(){
      this.options.isBeingDragged = false;
    }
  }
});

jQuery.fn.stopDrag.fadeOut = function(){
  this.fadeOut(2000);
};

A little bit contrived, but just an example (jQuery.plugin is pretty
rough at the moment - haven't had a chance to mess with it since last
fall, and only then it was for an hour or two).

The important thing here is being able to extend the existing plugin
methods - plugins for plugins.

> I'm more than happy with widget.js if you can easily expand on the
> widget.  For example,  quickly added a delegated hoverenter that will
> show a tooltip, or change an existing function.

I agree that something like this should be very easy. Does anyone have
any examples of plugins that they wished to extend in a particular
manner? (I needed the validation plugins X method to do Y - examples
like that.)

> I don't think super is necessary at all.  I've only used it a few
> times, never needed it.  But if you let go of _super, and you are able
> to easily expand the widget, how is that different than what you are
> considering OOP?

I think we're probably conflating the terms here. I'm using the term
OOP to imply adding on a Java-Class-style solution to jQuery as a
magic wand to take care of any complexity problems when, in fact, a
much more fine-tuned approach might be more appropriate (dealing with
jQuery-specific concepts like option encapsulation and event
triggering and communication, for example).

--John

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to