Skip to content

Commit 99f466b

Browse files
committed
jQuery.widget: Adding an example for _getCreateOptions()
1 parent 33fa344 commit 99f466b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

entries/jQuery.widget.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ _destroy: function() {
213213
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.
214214
</desc>
215215
<example>
216-
<desc>Pass the widget's options <code>create</code> event handlers as an argument.</desc>
216+
<desc>Pass the widget's options to <code>create</code> event handlers as an argument.</desc>
217217
<code><![CDATA[
218218
_getCreateEventData: function() {
219219
return this.options;
@@ -223,8 +223,16 @@ _getCreateEventData: function() {
223223
</method>
224224
<method name="_getCreateOptions" return="Object">
225225
<desc>
226-
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.
226+
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.
227227
</desc>
228+
<example>
229+
<desc>Make the widget element's id attribute available as an option.</desc>
230+
<code><![CDATA[
231+
_getCreateOptions: function() {
232+
return { id: this.element.attr( "id" ) };
233+
}
234+
]]></code>
235+
</example>
228236
</method>
229237
<method name="_init">
230238
<desc>

0 commit comments

Comments
 (0)