Skip to content

Document safe way to access the information of an element with a widget bound to it #77

Closed
FagnerMartinsBrack opened this Issue Dec 13, 2012 · 5 comments

4 participants

@FagnerMartinsBrack

As discussed on http://bugs.jqueryui.com/ticket/8908, element.is( ":data(namespace-widget)" ) should be documented as a safe way to detect if a widget is being used in a given element.

Suggestion 1: It can be written under "Additional Notes" of each component like "Detect if the widget is active on the element: $( ".selector" ).is( ":data(namespace-widget)" )"

Suggestion 2: It can be written along with the destroy() method in Code examples: like:

Code Examples:

Detect if the widget is active on the element:

$( ".selector" ).is( ":data(namespace-widget)" );

@tjvantoll
jQuery Foundation member

This is likely going to be addressed by jquery/jquery-ui#902.

@scottgonzalez
jQuery Foundation member

Yup, but for old versions, we should document the selector approach.

@tjvantoll tjvantoll added a commit to tjvantoll/api.jqueryui.com that referenced this issue Feb 17, 2013
@tjvantoll tjvantoll Widget: Document how to retrieve a widget's instance and how to tell …
…whether an element has a widget bound to it. Fixes #77.
97807c1
@tjvantoll tjvantoll added a commit that closed this issue Feb 21, 2013
@tjvantoll tjvantoll Widget: Document how to retrieve a widget's instance and how to tell …
…whether an element has a widget bound to it. Fixes #77.
97807c1
@tjvantoll tjvantoll closed this in 97807c1 Feb 21, 2013
@tjvantoll
jQuery Foundation member

A section about this was added in the widget's factory's docs, but we still want something on the individual widget's pages. Reopening this so I remember to do that.

@tjvantoll tjvantoll reopened this Feb 21, 2013
@jzaefferer
jQuery Foundation member

Once the instance method landed, we also need to update the new Instance section.

@tjvantoll
jQuery Foundation member

@jzaefferer See #114.

I think that pull covers most of this issue. The one thing remaining is we don't have a means of determining whether an element has a given widget bound to it documented on each widget's page as the OP suggested. Currently it's only documented on the widget factory's main API page.

@tjvantoll tjvantoll added a commit to tjvantoll/api.jqueryui.com that referenced this issue Mar 22, 2013
@tjvantoll tjvantoll jQuery.widget: Document that instance can be called on any element to…
… determine whether it is a widget. Fixes #77.
9db5f21
@tjvantoll tjvantoll added a commit that closed this issue Mar 26, 2013
@tjvantoll tjvantoll jQuery.widget: Document that instance can be called on any element to…
… determine whether it is a widget. Fixes #77.

jQuery.widget: More explicit wording to clarify the difference between using :data and instance().

jQuery.widget: Minor updates
cde5d57
@tjvantoll tjvantoll closed this in cde5d57 Mar 26, 2013
@scottgonzalez scottgonzalez added a commit that referenced this issue Apr 2, 2013
@scottgonzalez scottgonzalez Revert "jQuery.widget: Document that instance can be called on any el…
…ement to determine whether it is a widget. Fixes #77."

This reverts commit cde5d57.
404a476
@scottgonzalez scottgonzalez added a commit that referenced this issue Apr 2, 2013
@scottgonzalez scottgonzalez Revert "Revert "jQuery.widget: Document that instance can be called o…
…n any element to determine whether it is a widget. Fixes #77.""

This reverts commit 404a476.
b130181
@scottgonzalez scottgonzalez added a commit that referenced this issue Nov 27, 2013
@scottgonzalez scottgonzalez Revert "Revert "jQuery.widget: Document that instance can be called o…
…n any element to determine whether it is a widget. Fixes #77.""

This reverts commit 404a476.
3db7b03
@scottgonzalez scottgonzalez added a commit that referenced this issue Nov 27, 2013
@scottgonzalez scottgonzalez Revert "Revert "jQuery.widget: Document that instance can be called o…
…n any element to determine whether it is a widget. Fixes #77.""

This reverts commit 404a476.
ec72b60
@scottgonzalez scottgonzalez added a commit that referenced this issue Dec 5, 2013
@scottgonzalez scottgonzalez Revert "Revert "jQuery.widget: Document that instance can be called o…
…n any element to determine whether it is a widget. Fixes #77.""

This reverts commit 404a476.
38077ba
@scottgonzalez scottgonzalez added a commit that referenced this issue Dec 12, 2013
@scottgonzalez scottgonzalez Revert "Revert "jQuery.widget: Document that instance can be called o…
…n any element to determine whether it is a widget. Fixes #77.""

This reverts commit 404a476.
1a7bd4e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.