diff --git a/entries/jQuery.widget.xml b/entries/jQuery.widget.xml index 22b58a21..58ec3521 100644 --- a/entries/jQuery.widget.xml +++ b/entries/jQuery.widget.xml @@ -87,25 +87,32 @@

Instance

-

The widget's instance can be retrieved from a given element using the instance method.

+

The widget's instance can be retrieved from a given element using the instance() method.


 				$( "#elem" ).progressbar( "instance" );
 			
-

If the instancemethod is called on an element that is not associated with the widget, undefined is returned.

+

If the instance() method is called on an element that is not associated with the widget, undefined is returned.


 				$( "#not-a-progressbar" ).progressbar( "instance" ); // undefined
 			
-

The instance is stored using jQuery.data() with the widget's full name as the key. Therefore, you can use the :data selector to determine whether an element has a given widget bound to it.

+

The instance is stored using jQuery.data() with the widget's full name as the key. Therefore, the :data selector can also determine whether an element has a given widget bound to it.


 				$( "#elem" ).is( ":data( 'ui-progressbar' )" ); // true
 				$( "#elem" ).is( ":data( 'ui-draggable' )" ); //false
 			
+

Unlike instance(), :data can be used even if the widget being tested for has not loaded.

+ +

+				$( "#elem" ).nonExistentWidget( "instance" ); // TypeError
+				$( "#elem" ).is( ":data( 'ui-nonExistentWidget' )" ); // false
+			
+

You can also use :data to get a list of all elements that are instances of a given widget.


diff --git a/includes/widget-method-instance.xml b/includes/widget-method-instance.xml
index af646b25..ab7c8177 100644
--- a/includes/widget-method-instance.xml
+++ b/includes/widget-method-instance.xml
@@ -1,6 +1,8 @@
 
 
 	
-		Retrieves the 's instance object. Unlike other widget methods, instance is safe to call on any element after the  plugin has loaded. If the element does not have an associated instance, undefined is returned.
+		

Retrieves the 's instance object. If the element does not have an associated instance, undefined is returned.

+ +

Unlike other widget methods, instance() is safe to call on any element after the plugin has loaded.