Permalink
Browse files

jQuery.widget: Adding an example for _getCreateOptions()

  • Loading branch information...
1 parent 33fa344 commit 99f466b922d63a95d42acef0b1179bb38cf21e1f @tjvantoll tjvantoll committed Oct 1, 2013
Showing with 10 additions and 2 deletions.
  1. +10 −2 entries/jQuery.widget.xml
View
@@ -213,7 +213,7 @@ _destroy: function() {
All widgets trigger the <a href="#event-create"><code>create</code></a> event. By default, no data is provided in the event, but this method can return an object which will be passed as the <code>create</code> event's data.
</desc>
<example>
- <desc>Pass the widget's options <code>create</code> event handlers as an argument.</desc>
+ <desc>Pass the widget's options to <code>create</code> event handlers as an argument.</desc>
<code><![CDATA[
_getCreateEventData: function() {
return this.options;
@@ -223,8 +223,16 @@ _getCreateEventData: function() {
</method>
<method name="_getCreateOptions" return="Object">
<desc>
- This method allows the widget to define a custom method for defining options during instantiation. This user-provided options override the options returned by this method which override the default options.
+ This method allows the widget to define a custom method for defining options during instantiation. The user-provided options override the options returned by this method, which override the default options.
</desc>
+ <example>
+ <desc>Make the widget element's id attribute available as an option.</desc>
+ <code><![CDATA[
+_getCreateOptions: function() {
+ return { id: this.element.attr( "id" ) };
+}
+]]></code>
+ </example>
</method>
<method name="_init">
<desc>

0 comments on commit 99f466b

Please sign in to comment.