On Mon, Mar 2, 2009 at 8:04 AM, Scott González <[email protected]>wrote:

>
> The most reliable and least likely to change would be
>
> $('#widget-id').is(':data(dialog)')
>
> This is interesting in the sense that we haven't promoted this and we
> explicitly state that any and all direct use of the plugin instance is
> unsupported (may change at any time).  However, since this isn't
> actually doing anything with the instance, just checking that it
> exists, I think it would be okay.


Yeah, I thought of that, but didn't mention it for just the reason you
stated, it's not part of our public API, even if fairly stable.


>
> Perhaps an even better solution would be for us to bring back the
> custom selectors that existed in 1.0, so you could just do:
>
> $('#widget').is(':dialog')
>
> Both solutions have potential naming conflicts, so maybe introduce:
>
> $('#widget').is(':ui-dialog')
>
> I'll bring this up on jquery-ui-dev.


Thanks.

- Richard


>
>
>
> On Mar 2, 4:15 am, "Richard D. Worth" <[email protected]> wrote:
> > Using the CSS class names seem fairly reasonable, if imperfact. One could
> > make (in fact I would make) quite a strong argument that they are in fact
> > part of our public API. In this particular use, the example you show
> > (dialog) points out one of few gotchas. The element on which you call
> > .dialog gets a class of ui-dialog-content and gets wrapped by a ui-dialog
> > element. This is a bit of an exception, as the norm is for the class
> > 'ui-{pluginname}' to be added to the same element on which
> > .{pluginname}([options]) is called.
> >
> > That said, I don't know that there is a way currently to check (via
> > pluginname, reliably) whether a plugin has been initialized on an
> element.
> > You could enter a feature request ticket for this here:
> >
> > http://dev.jqueryui.com/newticket(note<http://dev.jqueryui.com/newticket%28note>:
> requires registration)
> >
> > - Richard
> >
> > On Sun, Mar 1, 2009 at 11:02 AM, Keith <[email protected]> wrote:
> >
> > > Seems like this is an easy one, but I'm not having luck.
> >
> > > Currently I do this.
> >
> > > if( ! $("#widget-id").hasClass("ui-dialog-content") ) {
> >
> > >   // setup dialog and do other expensive stuff
> >
> > > }
> >
> > > But of course that depends on the CSS class names used.  Is there a
> > > better way, using only the public API?
> >
> > > Thanks.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" 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-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to