Custom Selectors for Plugins

117 views
Skip to first unread message

Scott González

unread,
Mar 2, 2009, 8:12:26 AM3/2/09
to jQuery UI Development
On the jquery-ui list, someone asked how they can tell if a plugin has
already been initialized on an element. They're currently using class
detection, e.g., .is('.ui-dialog-content') but wondering if there's a
better way.

Right now I think the most reliable method is .is(':data
(pluginName)'), but I'd like to suggest adding custom selectors to all
the widgets and interactions like we had in previous versions: .is
(':ui-pluginName'). This could even be done through $.widget to
prevent us from having to do this in each plugin.

Thoughts?

original thread: http://groups.google.com/group/jquery-ui/browse_thread/thread/88800038d0e25df8

Jörn Zaefferer

unread,
Mar 2, 2009, 8:16:02 AM3/2/09
to jquery...@googlegroups.com
Adding it to $.widget makes sense. The expression would just check the
data, right?

Jörn

Richard D. Worth

unread,
Mar 2, 2009, 8:16:44 AM3/2/09
to jquery...@googlegroups.com
On Mon, Mar 2, 2009 at 8:12 AM, Scott González <scott.g...@gmail.com> wrote:

On the jquery-ui list, someone asked how they can tell if a plugin has
already been initialized on an element.  They're currently using class
detection, e.g., .is('.ui-dialog-content') but wondering if there's a
better way.

Right now I think the most reliable method is .is(':data
(pluginName)'), but I'd like to suggest adding custom selectors to all
the widgets and interactions like we had in previous versions: .is
(':ui-pluginName').  This could even be done through $.widget to
prevent us from having to do this in each plugin.

Thoughts?

+1

- Richard

Eduardo Lundgren

unread,
Mar 2, 2009, 8:30:47 AM3/2/09
to jquery...@googlegroups.com
+1
--
Eduardo Lundgren
Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.

Scott González

unread,
Mar 2, 2009, 8:41:36 AM3/2/09
to jquery...@googlegroups.com
On 3/2/09, Jörn Zaefferer <joern.z...@googlemail.com> wrote:
>
> Adding it to $.widget makes sense. The expression would just check the
> data, right?

Yeah.

Paul Bakaus

unread,
Mar 2, 2009, 9:34:21 AM3/2/09
to jquery...@googlegroups.com
We can do that. We actually had this implemented before, but removed it to whatever reason.
--
Paul Bakaus
UI Architect
--
http://paulbakaus.com
http://www.linkedin.com/in/paulbakaus

Scott González

unread,
Mar 2, 2009, 6:56:12 PM3/2/09
to jQuery UI Development
Reply all
Reply to author
Forward
0 new messages