Widget Auto Getters

31 views
Skip to first unread message

Scott González

unread,
Apr 25, 2009, 11:25:32 AM4/25/09
to jQuery UI Development
Right now the widget factory detects if a method is chainable by checking for a return value equal to the plugin instance.  I'd like to change this to look for undefined (I'd be okay with allowing both).  Any objections?

Jörn Zaefferer

unread,
Apr 25, 2009, 11:35:46 AM4/25/09
to jquery...@googlegroups.com
Makes sense and would require less changes in general.

Danny seems to agree, too:
http://youngisrael-stl.org/wordpress/2009/04/23/improving-jquery-ui-widget-getterssetters/

Jörn

2009/4/25 Scott González <scott.g...@gmail.com>:

Paul Bakaus

unread,
Apr 25, 2009, 1:04:56 PM4/25/09
to jquery...@googlegroups.com
I agree. Wanted to propose that anyway.

On Saturday, April 25, 2009, Scott González <scott.g...@gmail.com> wrote:
> Right now the widget factory detects if a method is chainable by checking for a return value equal to the plugin instance.  I'd like to change this to look for undefined (I'd be okay with allowing both).  Any objections?
>
> >
>

--
Paul Bakaus
UI Architect
--
http://paulbakaus.com
http://www.linkedin.com/in/paulbakaus

Danny

unread,
Apr 26, 2009, 2:41:04 PM4/26/09
to jQuery UI Development
I certainly agree (since it looks like it was my suggestion) but you
have to be careful that no existing getters return undefined.
Specifically, I could imagine that widget('option', 'foo') may want to
return undefined for options that are not set. You could require that
option return null in that case.

Danny

On Apr 25, 12:04 pm, Paul Bakaus <paul.bak...@googlemail.com> wrote:
> I agree. Wanted to propose that anyway.
>

Scott González

unread,
Apr 26, 2009, 6:19:12 PM4/26/09
to jquery...@googlegroups.com
Yeah, the thought is that you would never return undefined as a value for a getter, you would always have to return null for missing/unset values.  I think jQuery core does this in various places already.

Scott González

unread,
Jun 14, 2009, 10:02:03 PM6/14/09
to jquery...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages