only when it's better stated in jquery! which is always!

On 11/30/06, Matt Stith <[EMAIL PROTECTED]> wrote:

>Remember not everything needs to look like jQuery.

Or does it?

On 11/30/06, Stephen Howard <[EMAIL PROTECTED] > wrote:
>
> I know we're all fond of the elegance of chaining, but would it be the
> least confusing to write it like:
>
> var gridControl = new Grid( '#grid' )
>
> where:
>
> function Grid( dom_string ) {
>
>     jQuery( dom_string ).each( function() { instantiate here... } );
>     ...
> }
>
> Remember not everything needs to look like jQuery.
>
> - Stephen
>
> Dave Methvin wrote:
> > This will be a short thread--NOT! :-)
> >
> >
> >> Controller set of methods is returned..
> >>
> >> $('#grid').grid().data(data).drig().show()
> >> $('#grid').grid().scrollToRow(6).drig().css("border", "1px")
> >>
> >
> > Uh, drig()? So if I want to return to I was before scrollToRow(6),
> should I
> > use (6)woRoTllorsc?  ;-)
> >
> > I don't know if this a good idiom; changing the object type within the
> chain
> > might be be too tricky. Also, would the plugin itself have a need for
> > chained methods to change its internal state? Still, to make your
> object
> > chainable like that, I think your $().grid method would just need to
> save
> > its jQuery "this" in your Grid object before returning:
> >
> > jQuery.fn.grid = function() {
> >   var gridObject = // ... get your grid object ...
> >   gridObject.jQuery = this;
> >   return gridObject;
> > }
> > jQuery.fn.drig = function() {
> >   return this.jQuery;
> > }
> >
> > As Jörn mentioned, you could still use $("#grid").grid() to create
> and/or
> > retrieve a Grid object, even if it wasn't chainable. It seems like
> you'd
> > want some way to determine whether it was a Grid creation or just
> getting an
> > existing object; you could have a separate $().createGrid() method or
> maybe
> > the $().grid() argument could be required on creation. (Also, should
> the
> > core should a standard way for plugins to associate object data with
> an
> > element, like it does with events?)
> >
> > Whatever results from this discussion should go to the plugins
> authoring
> > page on the wiki, http://jquery.com/plugins/Authoring/
> >
> >
> > _______________________________________________
> > jQuery mailing list
> > discuss@jquery.com
> > http://jquery.com/discuss/
> >
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/





--
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to