Skip to content

Commit 7b37310

Browse files
committed
jQuery.widget: Adding code examples for enable(), disable(), and widget().
1 parent dfb2a85 commit 7b37310

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed

entries/jQuery.widget.xml

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,52 @@ this._on( this.element, {
192192
]]></code>
193193
</example>
194194
</method>
195-
<xi:include href="../includes/widget-method-disable.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
196-
<xi:include href="../includes/widget-method-enable.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
195+
<method name="disable">
196+
<desc>
197+
Disables the <placeholder name="name"/>.
198+
</desc>
199+
<example>
200+
<desc>Disable the widget when any of its anchors are clicked.</desc>
201+
<code><![CDATA[
202+
this._on( this.element, {
203+
"click a": function( event ) {
204+
event.preventDefault();
205+
this.disable();
206+
}
207+
});
208+
]]></code>
209+
</example>
210+
</method>
211+
<method name="enable">
212+
<desc>
213+
Enables the <placeholder name="name"/>.
214+
</desc>
215+
<example>
216+
<desc>Enable the widget when any of its anchors are clicked.</desc>
217+
<code><![CDATA[
218+
this._on( this.element, {
219+
"click a": function( event ) {
220+
event.preventDefault();
221+
this.enable();
222+
}
223+
});
224+
]]></code>
225+
</example>
226+
</method>
197227
<xi:include href="../includes/widget-method-option.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
198-
<xi:include href="../includes/widget-method-widget.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
228+
<method name="widget" return="jQuery" example-return-var="widget">
229+
<desc>
230+
Returns a <code>jQuery</code> object containing the <placeholder name="widget-element"/>.
231+
</desc>
232+
<example>
233+
<desc>Place a red border around the widget's original element when it's created.</desc>
234+
<code><![CDATA[
235+
_create: function() {
236+
this.widget().css( "border", "2px solid red" );
237+
}
238+
]]></code>
239+
</example>
240+
</method>
199241
<method name="_create">
200242
<desc>
201243
The <code>_create()</code> method is the widget's constructor.

0 commit comments

Comments
 (0)